diff libpurple/protocols/msn/slplink.c @ 30088:e432507151d1

NULL-ify some reverse links so that there's no double-free on exit.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 23 May 2010 21:45:19 +0000
parents 11e748b759a2
children 287fc4ac2bd9
line wrap: on
line diff
--- a/libpurple/protocols/msn/slplink.c	Sun May 23 17:26:20 2010 +0000
+++ b/libpurple/protocols/msn/slplink.c	Sun May 23 21:45:19 2010 +0000
@@ -101,8 +101,11 @@
 
 	session = slplink->session;
 
-	if (slplink->dc != NULL)
+	if (slplink->dc != NULL) {
+		slplink->dc->slplink = NULL;
 		msn_dc_destroy(slplink->dc);
+		slplink->dc = NULL;
+	}
 
 	while (slplink->slp_calls != NULL)
 		msn_slpcall_destroy(slplink->slp_calls->data);
@@ -203,12 +206,16 @@
 	/* The slplink has no slpcalls in it, release it from MSN_SB_FLAG_FT.
 	 * If nothing else is using it then this might cause swboard to be
 	 * destroyed. */
-	if (slplink->slp_calls == NULL && slplink->swboard != NULL)
+	if (slplink->slp_calls == NULL && slplink->swboard != NULL) {
 		msn_switchboard_release(slplink->swboard, MSN_SB_FLAG_FT);
+		slplink->swboard = NULL;
+	}
 
 	/* The slplink has no slpcalls in it, release it from the DC. */
-	if (slplink->slp_calls == NULL && slplink->dc != NULL)
+	if (slplink->slp_calls == NULL && slplink->dc != NULL) {
 		msn_dc_destroy(slplink->dc);
+		slplink->dc = NULL;
+	}
 }
 
 MsnSlpCall *