pidgin: 25372190: Don't access uninitialized memory (I thi...

nosnilmot at pidgin.im nosnilmot at pidgin.im
Wed Apr 23 11:05:44 EDT 2008


-----------------------------------------------------------------
Revision: 253721900cc20da174e7adb4967375b59fdf4503
Ancestor: ec507eeb0d289eb6a5a90fa758ab76c6eef70208
Author: nosnilmot at pidgin.im
Date: 2008-04-23T14:54:00
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/253721900cc20da174e7adb4967375b59fdf4503

Modified files:
        libpurple/protocols/silc/silc.c

ChangeLog: 

Don't access uninitialized memory (I think this might actually fix some
silc connection oddness I've been seeing too), and a leak fix or two.

-------------- next part --------------
============================================================
--- libpurple/protocols/silc/silc.c	4cb66f395a6bdf6182066e20e242c18165b06ade
+++ libpurple/protocols/silc/silc.c	60246aeab3771b2e685177b36c27b001f6b1c7f0
@@ -380,14 +380,6 @@ silcpurple_stream_created(SilcSocketStre
 
 	client = sg->client;
 
-	/* Progress */
-	if (params.detach_data) {
-		purple_connection_update_progress(gc, _("Resuming session"), 2, 5);
-		sg->resuming = TRUE;
-	} else {
-		purple_connection_update_progress(gc, _("Performing key exchange"), 2, 5);
-	}
-
 	/* Get session detachment data, if available */
 	memset(&params, 0, sizeof(params));
 	dfile = silcpurple_session_file(purple_account_get_username(sg->account));
@@ -397,6 +389,14 @@ silcpurple_stream_created(SilcSocketStre
 	params.ignore_requested_attributes = FALSE;
 	params.pfs = purple_account_get_bool(sg->account, "pfs", FALSE);
 
+	/* Progress */
+	if (params.detach_data) {
+		purple_connection_update_progress(gc, _("Resuming session"), 2, 5);
+		sg->resuming = TRUE;
+	} else {
+		purple_connection_update_progress(gc, _("Performing key exchange"), 2, 5);
+	}
+
 	/* Perform SILC Key Exchange. */
 	silc_client_key_exchange(sg->client, &params, sg->public_key,
 				 sg->private_key, stream, SILC_CONN_SERVER,
@@ -550,8 +550,12 @@ silcpurple_login(PurpleAccount *account)
 		                             _("Cannot initialize SILC protocol"));
 		gc->proto_data = NULL;
 		silc_free(sg);
+		free(hostname);
+		free(username);
 		return;
 	}
+	free(hostname);
+	free(username);
 
 	/* Check the ~/.silc dir and create it, and new key pair if necessary. */
 	if (!silcpurple_check_silc_dir(gc)) {


More information about the Commits mailing list