# HG changeset patch # User Paul Aurich # Date 1239575014 0 # Node ID 5d1140b0b10a5dcff909fe94a2749053e6c71743 # Parent 7f9443c311018b966963443986e4c868e377df7e 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) diff -r 7f9443c31101 -r 5d1140b0b10a libpurple/network.c --- a/libpurple/network.c Sun Apr 12 21:53:41 2009 +0000 +++ b/libpurple/network.c Sun Apr 12 22:23:34 2009 +0000 @@ -825,8 +825,13 @@ *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 diff -r 7f9443c31101 -r 5d1140b0b10a libpurple/protocols/jabber/google.c --- a/libpurple/protocols/jabber/google.c Sun Apr 12 21:53:41 2009 +0000 +++ b/libpurple/protocols/jabber/google.c Sun Apr 12 22:23:34 2009 +0000 @@ -1156,7 +1156,12 @@ } } - 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 diff -r 7f9443c31101 -r 5d1140b0b10a libpurple/stun.c --- a/libpurple/stun.c Sun Apr 12 21:53:41 2009 +0000 +++ b/libpurple/stun.c Sun Apr 12 22:23:34 2009 +0000 @@ -341,6 +341,12 @@ } 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();