]> xenbits.xensource.com Git - libvirt.git/commitdiff
virNetServerPreExecRestart: Check for retval of virJSONValueNewArray()
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 14 May 2019 08:39:27 +0000 (10:39 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 14 May 2019 13:56:45 +0000 (15:56 +0200)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
src/rpc/virnetserver.c

index 83b871764f5a0f0d82cd7f1b26028d5cd76296d3..4934dba967108896b174806befbbc26f9edf0add 100644 (file)
@@ -629,7 +629,9 @@ virJSONValuePtr virNetServerPreExecRestart(virNetServerPtr srv)
         goto error;
     }
 
-    services = virJSONValueNewArray();
+    if (!(services = virJSONValueNewArray()))
+        goto error;
+
     if (virJSONValueObjectAppend(object, "services", services) < 0) {
         virJSONValueFree(services);
         goto error;
@@ -646,7 +648,9 @@ virJSONValuePtr virNetServerPreExecRestart(virNetServerPtr srv)
         }
     }
 
-    clients = virJSONValueNewArray();
+    if (!(clients = virJSONValueNewArray()))
+        goto error;
+
     if (virJSONValueObjectAppend(object, "clients", clients) < 0) {
         virJSONValueFree(clients);
         goto error;