im.pidgin.pidgin: ed57ec421d050f904b97089466de8ae146506957

datallah at pidgin.im datallah at pidgin.im
Thu Oct 25 19:37:23 EDT 2007


-----------------------------------------------------------------
Revision: ed57ec421d050f904b97089466de8ae146506957
Ancestor: b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Author: datallah at pidgin.im
Date: 2007-10-25T23:28:01
Branch: im.pidgin.pidgin

Modified files:
        libpurple/protocols/yahoo/yahoo_aliases.c

ChangeLog: 

Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails.  When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo_aliases.c	864966ba7de997ee3ababe78354456e6ca4a58b8
+++ libpurple/protocols/yahoo/yahoo_aliases.c	a3f042baa93abd7c47e56377811e54d9b6d5e4b9
@@ -63,7 +63,8 @@ yahoo_fetch_aliases_cb(PurpleUtilFetchUr
 	yd->url_datas = g_slist_remove(yd->url_datas, url_data);
 
 	if (len == 0) {
-		purple_debug_info("yahoo","No Aliases to process\n");
+		purple_debug_info("yahoo", "No Aliases to process.%s%s\n",
+						  error_message ? " Error:" : "", error_message ? error_message : "");
 	} else {
 		const char *yid, *full_name, *nick_name, *alias, *id, *fn, *ln, *nn;
 		PurpleBuddy *b = NULL;
@@ -160,8 +161,6 @@ yahoo_fetch_aliases(PurpleConnection *gc
 	url_data = purple_util_fetch_url_request(url, FALSE, NULL, TRUE, request, FALSE, yahoo_fetch_aliases_cb, cb);
 	if (url_data != NULL) {
 		yd->url_datas = g_slist_prepend(yd->url_datas, url_data);
-	} else {
-		g_free(cb);
 	}
 
 	g_free(url);
@@ -183,12 +182,22 @@ yahoo_update_alias_cb(PurpleUtilFetchUrl
 	yd = gc->proto_data;
 	yd->url_datas = g_slist_remove(yd->url_datas, url_data);
 
+	if (len == 0 || error_message != NULL) {
+		purple_debug_info("yahoo", "Error updating alias: %s\n",
+						  error_message ? error_message : "");
+		g_free(cb->id);
+		g_free(cb);
+		return;
+	}
+
 	result = xmlnode_from_str(url_text, -1);
 
 	purple_debug_info("yahoo", "ID: %s, Return data: %s\n",cb->id, url_text);
 
 	if (result == NULL) {
-		purple_debug_error("yahoo","Alias update faild: Badly formed response\n");
+		purple_debug_error("yahoo","Alias update failed: Badly formed response\n");
+		g_free(cb->id);
+		g_free(cb);
 		return;
 	}
 
@@ -259,9 +268,6 @@ yahoo_update_alias(PurpleConnection *gc,
 	url_data = purple_util_fetch_url_request(url, FALSE, NULL, TRUE, request, FALSE, yahoo_update_alias_cb, cb);
 	if (url_data != NULL) {
 		yd->url_datas = g_slist_prepend(yd->url_datas, url_data);
-	} else {
-		g_free(cb->id);
-		g_free(cb);
 	}
 
 	g_free(content);


More information about the Commits mailing list