/* 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);