pidgin: b8e84903: Fix a crash Jacky Lam noted on devel at pid...

rlaager at pidgin.im rlaager at pidgin.im
Mon Nov 17 14:35:21 EST 2008


-----------------------------------------------------------------
Revision: b8e84903d007dcecc0f7146c0fab00060045dd35
Ancestor: 5ab28444f1f119924261f9a0f6f8d742bbb796ef
Author: rlaager at pidgin.im
Date: 2008-11-17T19:30:27
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/b8e84903d007dcecc0f7146c0fab00060045dd35

Modified files:
        COPYRIGHT libpurple/dnsquery.c

ChangeLog: 

Fix a crash Jacky Lam noted on devel at pidgin.im:
  Currently, I experience crash at dnsquery.c:purple_dnsquery_destroy()
  when my WiFi AP suddenly off while I am online with libpurple.

  After tracing, I find the data struct PurpleDnsQueryData is freeing
  twice. The reason is when purple_dnsquery_failed() is called,
  purple_dnsquery_destroy() will try to free the PurpleDnsQueryData's
  resolver and itself. But purple_dnsquery_resolver_destroy()'s kill()
  will trigger the glib's input hook and finally called host_resolved()
  and eventually call purple_dnsquery_failed() again!!

-------------- next part --------------
============================================================
--- COPYRIGHT	94b35b611d831d4cdbd2d5fb3d6d9f85866b0bf7
+++ COPYRIGHT	b104b9cb95ce8e4291f0abdcd4a45d3e4c987dbf
@@ -220,6 +220,7 @@ Richard Laager
 Tuomas Kuosmanen
 Tero Kuusela
 Richard Laager
+Jacky Lam
 Scott Lamb
 Dennis Lambe Jr.
 Joe LaPenna
============================================================
--- libpurple/dnsquery.c	3220b7d2307a30138439f3eab7d7d9c21e5666e9
+++ libpurple/dnsquery.c	21a797fa86551f10e97cef0e37ed5069ba01941c
@@ -345,6 +345,12 @@ purple_dnsquery_resolver_destroy(PurpleD
 {
 	g_return_if_fail(resolver != NULL);
 
+	/* Keep this before the kill() call below. */
+	if (resolver->inpa != 0) {
+		purple_input_remove(resolver->inpa);
+		resolver->inpa = 0;
+	}
+
 	/*
 	 * We might as well attempt to kill our child process.  It really
 	 * doesn't matter if this fails, because children will expire on
@@ -353,9 +359,6 @@ purple_dnsquery_resolver_destroy(PurpleD
 	if (resolver->dns_pid > 0)
 		kill(resolver->dns_pid, SIGKILL);
 
-	if (resolver->inpa != 0)
-		purple_input_remove(resolver->inpa);
-
 	close(resolver->fd_in);
 	close(resolver->fd_out);
 


More information about the Commits mailing list