From 373dc531148992c6a5cf57b2fae29286afd70488 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 6 Sep 2007 17:20:03 +0000 Subject: [PATCH] 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 --- avahi-compat-libdns_sd/compat.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 */ -- 2.39.5