summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--avahi-daemon/static-services.c15
1 files 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);