changeset 22111:603d5325af4c

Prevent a crash caused by freed memory being accessed.
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 14 Jan 2008 23:29:52 +0000
parents d8cc610bd388
children 5b6d6ea542b8
files libpurple/protocols/bonjour/jabber.c libpurple/protocols/bonjour/jabber.h
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/jabber.c	Mon Jan 14 22:23:54 2008 +0000
+++ b/libpurple/protocols/bonjour/jabber.c	Mon Jan 14 23:29:52 2008 +0000
@@ -995,7 +995,7 @@
 			bb->conversation = NULL;
 	}
 
-	purple_timeout_add(0, _async_bonjour_jabber_close_conversation_cb, bconv);
+	bconv->close_timeout = purple_timeout_add(0, _async_bonjour_jabber_close_conversation_cb, bconv);
 }
 
 void
@@ -1054,6 +1054,9 @@
 		if (bconv->context != NULL)
 			bonjour_parser_setup(bconv);
 
+		if (bconv->close_timeout != 0)
+			purple_timeout_remove(bconv->close_timeout);
+
 		g_free(bconv->buddy_name);
 		g_free(bconv->ip);
 		g_free(bconv);
--- a/libpurple/protocols/bonjour/jabber.h	Mon Jan 14 22:23:54 2008 +0000
+++ b/libpurple/protocols/bonjour/jabber.h	Mon Jan 14 23:29:52 2008 +0000
@@ -47,6 +47,7 @@
 	gint socket;
 	guint rx_handler;
 	guint tx_handler;
+	guint close_timeout;
 	PurpleCircBuffer *tx_buf;
 	int sent_stream_start; /* 0 = Unsent, 1 = Partial, 2 = Complete */
 	gboolean recv_stream_start;