From 2bfc136b58cc239f170f3b247257c5369b085570 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 7 Jan 2006 20:27:32 +0000 Subject: [PATCH] fix double free() bug git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1063 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-core/wide-area.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/avahi-core/wide-area.c b/avahi-core/wide-area.c index 0af1224..d86e548 100644 --- a/avahi-core/wide-area.c +++ b/avahi-core/wide-area.c @@ -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); -- 2.39.5