Fix a few warnings in the IRC SASL code release-2.x.y

Wed, 19 Sep 2012 22:57:46 -0400

author
Daniel Atallah <datallah@pidgin.im>
date
Wed, 19 Sep 2012 22:57:46 -0400
branch
release-2.x.y
changeset 33407
8003b9b9e602
parent 33406
be46dd6ba024
child 33408
8e037a7b4ccd

Fix a few warnings in the IRC SASL code

libpurple/protocols/irc/msgs.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/irc/msgs.c	Wed Sep 19 22:57:46 2012 -0400
+++ b/libpurple/protocols/irc/msgs.c	Wed Sep 19 22:57:46 2012 -0400
@@ -1439,6 +1439,7 @@
 irc_sasl_cb_secret(sasl_conn_t *conn, void *ctx, int id, sasl_secret_t **secret)
 {
 	struct irc_conn *irc = ctx;
+	sasl_secret_t *sasl_secret;
 	const char *pw;
 	size_t len;
 
@@ -1450,7 +1451,7 @@
 	len = strlen(pw);
 	/* Not an off-by-one because sasl_secret_t defines char data[1] */
 	/* TODO: This can probably be moved to glib's allocator */
-	sasl_secret_t *sasl_secret = malloc(sizeof(sasl_secret_t) + len);
+	sasl_secret = malloc(sizeof(sasl_secret_t) + len);
 	if (!sasl_secret)
 		return SASL_NOMEM;
 
@@ -1603,21 +1604,18 @@
 	if (!args[1] || !args[2] || strncmp(args[2], "sasl ", 6))
 		return;
 	if (strncmp(args[1], "ACK", 4)) {
-
-		gchar *tmp = g_strdup_printf(_("SASL authentication failed: Server does not support SASL authentication."));
+		const char *tmp = _("SASL authentication failed: Server does not support SASL authentication.");
 		purple_connection_error_reason (gc,
 			PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, tmp);
-		g_free(tmp);
 
 		irc_sasl_finish(irc);
 		return;
 	}
 
 	if ((ret = sasl_client_init(NULL)) != SASL_OK) {
-		gchar *tmp = g_strdup_printf(_("SASL authentication failed: Initializing SASL failed."));
+		const char *tmp = _("SASL authentication failed: Initializing SASL failed.");
 		purple_connection_error_reason (gc,
 			PURPLE_CONNECTION_ERROR_OTHER_ERROR, tmp);
-		g_free(tmp);
 		return;
 	}
 

mercurial