]> git.meshlink.io Git - catta/blobdiff - avahi-core/server.c
* fix memory handling when reading configuration files
[catta] / avahi-core / server.c
index 0c0065809bcbf87c2155bed994f9e89ff393a055..d03a2848e78f1dfa84e85b5d66df64aa3d94de59 100644 (file)
@@ -1275,10 +1275,7 @@ AvahiServer *avahi_server_new(GMainContext *c, const AvahiServerConfig *sc, Avah
     s->fd_legacy_unicast_ipv4 = s->fd_ipv4 >= 0 && s->config.enable_reflector ? avahi_open_legacy_unicast_socket_ipv4() : -1;
     s->fd_legacy_unicast_ipv6 = s->fd_ipv6 >= 0 && s->config.enable_reflector ? avahi_open_legacy_unicast_socket_ipv6() : -1;
 
-    if (c)
-        g_main_context_ref(s->context = c);
-    else
-        s->context = g_main_context_default();
+    g_main_context_ref(c->context = c ? c : g_main_context_default());
 
     /* Prepare IO source registration */
     s->source = g_source_new(&source_funcs, sizeof(GSource) + sizeof(AvahiServer*));