From: Lennart Poettering Date: Thu, 6 Sep 2007 17:20:03 +0000 (+0000) Subject: Fix a segfault when registering services with libdns_sd before the avahi daemon finis... X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=373dc531148992c6a5cf57b2fae29286afd70488;p=catta Fix a segfault when registering services with libdns_sd before the avahi daemon finished starting up; Closes rhbz 251700; Original patch from Tim Waugh git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1536 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- diff --git a/avahi-compat-libdns_sd/compat.c b/avahi-compat-libdns_sd/compat.c index 36bb84a..7c2686a 100644 --- a/avahi-compat-libdns_sd/compat.c +++ b/avahi-compat-libdns_sd/compat.c @@ -990,6 +990,16 @@ static void reg_client_callback(AvahiClient *s, AvahiClientState state, void* us return; } } + + if (!sdref->service_name_chosen) { + + assert(sdref->service_name); + + if (!(sdref->service_name_chosen = avahi_strdup(sdref->service_name))) { + reg_report_error(sdref, kDNSServiceErr_NoMemory); + return; + } + } /* Register the service */