changeset 20785:6da14d538231

Fix leakage in the win32 dnsquery implementation.
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 05 Oct 2007 05:28:54 +0000
parents ca0d0e4f8c91
children 996cc19d1f7e
files libpurple/dnsquery.c
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/dnsquery.c	Fri Oct 05 05:18:11 2007 +0000
+++ b/libpurple/dnsquery.c	Fri Oct 05 05:28:54 2007 +0000
@@ -637,9 +637,10 @@
 static gboolean
 dns_main_thread_cb(gpointer data)
 {
-	PurpleDnsQueryData *query_data;
+	PurpleDnsQueryData *query_data = data;
 
-	query_data = data;
+	/* We're done, so purple_dnsquery_destroy() shouldn't think it is canceling an in-progress lookup */
+	query_data->resolver = NULL;
 
 	if (query_data->error_message != NULL)
 		purple_dnsquery_failed(query_data, query_data->error_message);
@@ -713,7 +714,7 @@
 #endif
 
 	/* back to main thread */
-	g_idle_add(dns_main_thread_cb, query_data);
+	purple_timeout_add(0, dns_main_thread_cb, query_data);
 
 	return 0;
 }
@@ -780,14 +781,12 @@
 
 	purple_debug_info("dnsquery", "Performing DNS lookup for %s\n", hostname);
 
-	query_data = g_new(PurpleDnsQueryData, 1);
+	query_data = g_new0(PurpleDnsQueryData, 1);
 	query_data->hostname = g_strdup(hostname);
 	g_strstrip(query_data->hostname);
 	query_data->port = port;
 	query_data->callback = callback;
 	query_data->data = data;
-	query_data->error_message = NULL;
-	query_data->hosts = NULL;
 
 	if (strlen(query_data->hostname) == 0)
 	{