diff libpurple/protocols/msn/oim.c @ 28422:44cbfcaf9e3a

Fix a crash when sending OIMs on MSN. The callback function used after updating the token was incorrectly defined with void return and could be called again after the timeout (as would normally happen for timeouts that return TRUE). Thanks to Sadrul for getting a good backtrace and finding the real cause. Fixes #8155.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 24 Oct 2009 07:53:02 +0000
parents 3061a0c72b26
children 33b4ae796648
line wrap: on
line diff
--- a/libpurple/protocols/msn/oim.c	Sat Oct 24 00:59:12 2009 +0000
+++ b/libpurple/protocols/msn/oim.c	Sat Oct 24 07:53:02 2009 +0000
@@ -153,7 +153,7 @@
 	gpointer cb_data;
 } MsnOimRequestData;
 
-static void msn_oim_request_helper(MsnOimRequestData *data);
+static gboolean msn_oim_request_helper(MsnOimRequestData *data);
 
 static void
 msn_oim_request_cb(MsnSoapMessage *request, MsnSoapMessage *response,
@@ -202,7 +202,7 @@
 	g_free(data);
 }
 
-static void
+static gboolean
 msn_oim_request_helper(MsnOimRequestData *data)
 {
 	MsnSession *session = data->oim->session;
@@ -224,13 +224,13 @@
 		const char *msn_p;
 
 		token = msn_nexus_get_token(session->nexus, MSN_AUTH_MESSENGER_WEB);
-		g_return_if_fail(token != NULL);
+		g_return_val_if_fail(token != NULL, FALSE);
 
 		msn_t = g_hash_table_lookup(token, "t");
 		msn_p = g_hash_table_lookup(token, "p");
 
-		g_return_if_fail(msn_t != NULL);
-		g_return_if_fail(msn_p != NULL);
+		g_return_val_if_fail(msn_t != NULL, FALSE);
+		g_return_val_if_fail(msn_p != NULL, FALSE);
 
 		passport = xmlnode_get_child(data->body, "Header/PassportCookie");
 		xml_t = xmlnode_get_child(passport, "t");
@@ -248,6 +248,8 @@
 		msn_soap_message_new(data->action, xmlnode_copy(data->body)),
 		data->host, data->url, FALSE,
 		msn_oim_request_cb, data);
+
+	return FALSE;
 }