]> xenbits.xensource.com Git - libvirt.git/commitdiff
daemon: Add the admin service to the admin server only if it was allocated
authorPeter Krempa <pkrempa@redhat.com>
Thu, 18 Jun 2015 09:40:08 +0000 (11:40 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 18 Jun 2015 11:32:37 +0000 (13:32 +0200)
If the admin service is disabled it would not be allocated, but the NULL
pointer still would be added to the admin server. Since
virNetServerAddService would dereference it, the daemon would crash.

Move the service registration into the block that allocates it.

daemon/libvirtd.c

index 368e10ca354960360a39b4e2a4c1c0c14bfab5d4..286512ab3276d0d4f68c858253cc7f59ccc3f145 100644 (file)
@@ -534,10 +534,10 @@ daemonSetupNetworking(virNetServerPtr srv,
                                                   config->admin_max_queued_clients,
                                                   config->admin_max_client_requests)))
             goto error;
-    }
 
-    if (virNetServerAddService(srvAdm, svcAdm, NULL) < 0)
-        goto error;
+        if (virNetServerAddService(srvAdm, svcAdm, NULL) < 0)
+            goto error;
+    }
 
     if (ipsock) {
         if (config->listen_tcp) {