]> git.meshlink.io Git - catta/commitdiff
fix double free() bug
authorLennart Poettering <lennart@poettering.net>
Sat, 7 Jan 2006 20:27:32 +0000 (20:27 +0000)
committerLennart Poettering <lennart@poettering.net>
Sat, 7 Jan 2006 20:27:32 +0000 (20:27 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1063 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-core/wide-area.c

index 0af12244929d27f3c6f9f07ebd3251a801c02819..d86e5482a8e371c51ded74faa1bac80fae55c83c 100644 (file)
@@ -162,6 +162,17 @@ static void next_dns_server(AvahiWideAreaLookupEngine *e) {
         e->current_dns_server = 0;
 }
 
+static void lookup_stop(AvahiWideAreaLookup *l) {
+    assert(l);
+    
+    l->callback = NULL;
+
+    if (l->time_event) {
+        avahi_time_event_free(l->time_event);
+        l->time_event = NULL;
+    }
+}
+
 static void sender_timeout_callback(AvahiTimeEvent *e, void *userdata) {
     AvahiWideAreaLookup *l = userdata;
     struct timeval tv;
@@ -181,7 +192,7 @@ static void sender_timeout_callback(AvahiTimeEvent *e, void *userdata) {
         avahi_log_warn(__FILE__": Query timed out.");
         avahi_server_set_errno(l->engine->server, AVAHI_ERR_TIMEOUT);
         l->callback(l->engine, AVAHI_BROWSER_FAILURE, AVAHI_LOOKUP_RESULT_WIDE_AREA, NULL, l->userdata);
-        avahi_wide_area_lookup_free(l);
+        lookup_stop(l);
         return;
     }
 
@@ -260,17 +271,6 @@ AvahiWideAreaLookup *avahi_wide_area_lookup_new(
     return l;
 }
 
-static void lookup_stop(AvahiWideAreaLookup *l) {
-    assert(l);
-    
-    l->callback = NULL;
-
-    if (l->time_event) {
-        avahi_time_event_free(l->time_event);
-        l->time_event = NULL;
-    }
-}
-
 static void lookup_destroy(AvahiWideAreaLookup *l) {
     AvahiWideAreaLookup *t;
     assert(l);