pidgin: 0d90d403: Don't leak the struct sockaddr* from pur...

paul at darkrain42.org paul at darkrain42.org
Sun Apr 12 18:50:35 EDT 2009


-----------------------------------------------------------------
Revision: 0d90d40301d79df2eff00f05778ed05b29a51d6d
Ancestor: 8cb1331f389927855aabd3a2abdb5700a16310ca
Author: paul at darkrain42.org
Date: 2009-04-12T22:23:34
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/0d90d40301d79df2eff00f05778ed05b29a51d6d

Modified files:
        libpurple/network.c libpurple/protocols/jabber/google.c
        libpurple/stun.c

ChangeLog: 

Don't leak the struct sockaddr* from purple_dnsquery_a.

At least one of these gives me:
==00:00:06:28.468 13659== 32 bytes in 2 blocks are definitely lost in loss record 1,020 of 3,383
==00:00:06:28.468 13659==    at 0x04c278ae: malloc (vg_replace_malloc.c:207)
==00:00:06:28.468 13659==    by 0x09b29a12: g_malloc (gmem.c:131)
==00:00:06:28.468 13659==    by 0x07d2fd8c: host_resolved (dnsquery.c:578)

-------------- next part --------------
============================================================
--- libpurple/network.c	b8de44fcaca6aef09dffd0bb08350c792ed90754
+++ libpurple/network.c	b284207842afb12462d73674712c107c0109f903
@@ -825,8 +825,13 @@ purple_network_ip_lookup_cb(GSList *host
 		*ip = g_strdup(dst);
 		purple_debug_info("network", "set IP address: %s\n", *ip);
 	}
-	
-	g_slist_free(hosts);
+
+	while (hosts != NULL) {
+		hosts = g_slist_delete_link(hosts, hosts);
+		/* Free the address */
+		g_free(hosts->data);
+		hosts = g_slist_delete_link(hosts, hosts);
+	}
 }
 
 void
============================================================
--- libpurple/protocols/jabber/google.c	d2dd0de84617dea9ccca9b7d9ffe345cbfa31e60
+++ libpurple/protocols/jabber/google.c	d9c6c60bc06f5688aaf1b396d8b2ec7497f44ab3
@@ -1156,7 +1156,12 @@ jabber_google_stun_lookup_cb(GSList *hos
 		}
 	}
 
-	g_slist_free(hosts);
+	while (hosts != NULL) {
+		hosts = g_slist_delete_link(hosts, hosts);
+		/* Free the address */
+		g_free(hosts->data);
+		hosts = g_slist_delete_link(hosts, hosts);
+	}
 }
 
 static void
============================================================
--- libpurple/stun.c	e4f2b3d4c374182d54989682dd48110b078a2fbb
+++ libpurple/stun.c	3de844dce7cde79bedb3f0b5d33184777099aa2f
@@ -341,6 +341,12 @@ static void hbn_cb(GSList *hosts, gpoint
 	}
 
 	if (!purple_network_listen_range(12108, 12208, SOCK_DGRAM, hbn_listen_cb, hosts)) {
+		while(hosts) {
+			hosts = g_slist_remove(hosts, hosts->data);
+			g_free(hosts->data);
+			hosts = g_slist_remove(hosts, hosts->data);
+		}
+
 		nattype.status = PURPLE_STUN_STATUS_UNKNOWN;
 		nattype.lookup_time = time(NULL);
 		do_callbacks();


More information about the Commits mailing list