From: Peter Krempa Date: Thu, 18 Jun 2015 09:40:08 +0000 (+0200) Subject: daemon: Add the admin service to the admin server only if it was allocated X-Git-Tag: v1.2.17-rc1~135 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7d910d98de24dcc5fe3acfb2d37b6258f87ddfe;p=thirdparty%2Flibvirt.git daemon: Add the admin service to the admin server only if it was allocated 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. --- diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 368e10ca35..286512ab32 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -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) {