From 2cd808afb7c008600fd4384446adb3d52b4651f2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 21 Aug 2005 12:54:35 +0000 Subject: [PATCH] * fix a bug with bad collision handling in static services (Thanks Sebest!) git-svn-id: file:///home/lennart/svn/public/avahi/trunk@378 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-daemon/static-services.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/avahi-daemon/static-services.c b/avahi-daemon/static-services.c index f6aa193..e402a98 100644 --- a/avahi-daemon/static-services.c +++ b/avahi-daemon/static-services.c @@ -201,14 +201,15 @@ static void add_static_service_group_to_server(StaticServiceGroup *g) { /* This service group is already registered in the server */ return; - if (g->chosen_name) - avahi_free(g->chosen_name); - - if (g->replace_wildcards) - g->chosen_name = replacestr(g->name, "%h", avahi_server_get_host_name(avahi_server)); - else - g->chosen_name = avahi_strdup(g->name); + if (!g->chosen_name) { + + if (g->replace_wildcards) + g->chosen_name = replacestr(g->name, "%h", avahi_server_get_host_name(avahi_server)); + else + g->chosen_name = avahi_strdup(g->name); + } + if (!g->entry_group) g->entry_group = avahi_s_entry_group_new(avahi_server, entry_group_callback, g); -- 2.39.5