[PATCH 2/2] daemon: Add the admin service to the admin server only if it was allocated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 368e10c..286512a 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) {
-- 
2.4.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]