diff options
author | Paul Aurich <darkrain42@pidgin.im> | 2009-04-12 22:23:34 +0000 |
---|---|---|
committer | Paul Aurich <darkrain42@pidgin.im> | 2009-04-12 22:23:34 +0000 |
commit | 7f7400bf572827ba81ebd963ca0472ed34c72bcf (patch) | |
tree | eb111ab4112281bfb144bbbd7f56112fe158d067 | |
parent | d7550289e02fce2a666d8aaa5a798b1912f1c1fa (diff) | |
download | pidgin-7f7400bf572827ba81ebd963ca0472ed34c72bcf.tar.gz |
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)
-rw-r--r-- | libpurple/network.c | 9 | ||||
-rw-r--r-- | libpurple/protocols/jabber/google.c | 7 | ||||
-rw-r--r-- | libpurple/stun.c | 6 |
3 files changed, 19 insertions, 3 deletions
diff --git a/libpurple/network.c b/libpurple/network.c index 3fec1551e6..fb008f886f 100644 --- a/libpurple/network.c +++ b/libpurple/network.c @@ -825,8 +825,13 @@ purple_network_ip_lookup_cb(GSList *hosts, gpointer data, *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 --git a/libpurple/protocols/jabber/google.c b/libpurple/protocols/jabber/google.c index 7796a72391..83791c6a6d 100644 --- a/libpurple/protocols/jabber/google.c +++ b/libpurple/protocols/jabber/google.c @@ -1156,7 +1156,12 @@ jabber_google_stun_lookup_cb(GSList *hosts, gpointer data, } } - 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 --git a/libpurple/stun.c b/libpurple/stun.c index 9e39601241..8aad4cfdd3 100644 --- a/libpurple/stun.c +++ b/libpurple/stun.c @@ -341,6 +341,12 @@ static void hbn_cb(GSList *hosts, gpointer data, const char *error_message) { } 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(); |