[PATCH 06/14] rpc: Avoid resource leak of 'socks' if any object append fails

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

 



---
 src/rpc/virnetserverservice.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/rpc/virnetserverservice.c b/src/rpc/virnetserverservice.c
index 61dd682..5deacaa 100644
--- a/src/rpc/virnetserverservice.c
+++ b/src/rpc/virnetserverservice.c
@@ -356,9 +356,6 @@ virJSONValuePtr virNetServerServicePreExecRestart(virNetServerServicePtr svc)
     if (!object)
         return NULL;
 
-    if (!(socks = virJSONValueNewArray()))
-        goto error;
-
     if (virJSONValueObjectAppendNumberInt(object, "auth", svc->auth) < 0)
         goto error;
     if (virJSONValueObjectAppendBoolean(object, "readonly", svc->readonly) < 0)
@@ -366,6 +363,9 @@ virJSONValuePtr virNetServerServicePreExecRestart(virNetServerServicePtr svc)
     if (virJSONValueObjectAppendNumberUint(object, "nrequests_client_max", svc->nrequests_client_max) < 0)
         goto error;
 
+    if (!(socks = virJSONValueNewArray()))
+        goto error;
+
     if (virJSONValueObjectAppend(object, "socks", socks) < 0) {
         virJSONValueFree(socks);
         goto error;
-- 
1.7.11.7

--
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]