diff src/protocols/msn/slpmsg.c @ 10284:f776e117c17b

[gaim-migrate @ 11454] Several MSN memory leaks identified and fixed by Miah Gregory and Felipe Contreras, plus my own fix for bug 1075347. As normal, thank them for fixes, blame me for breakages. Did I mention the new MSN icon? It rocks! committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Wed, 01 Dec 2004 02:30:47 +0000
parents ecf3ce2e2ab1
children 56cc5d49472b
line wrap: on
line diff
--- a/src/protocols/msn/slpmsg.c	Wed Dec 01 01:17:46 2004 +0000
+++ b/src/protocols/msn/slpmsg.c	Wed Dec 01 02:30:47 2004 +0000
@@ -65,10 +65,20 @@
 
 	if (slpmsg->msg != NULL)
 	{
-		if (slpmsg->msg->trans != NULL)
+		MsnTransaction *trans;
+
+		trans = slpmsg->msg->trans;
+
+		if (trans != NULL)
 		{
-			slpmsg->msg->trans->callbacks = NULL;
-			slpmsg->msg->trans->data = NULL;
+			/* Something is pointing to this slpmsg, so we should remove that
+			 * pointer to prevent a crash. */
+
+			if (trans->callbacks != NULL && trans->has_custom_callbacks)
+				g_hash_table_destroy(trans->callbacks);
+			
+			trans->callbacks = NULL;
+			trans->data = NULL;
 		}
 	}