virNetServerPreExecRestart: Check for retval of virJSONValueNewArray()

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Michal Privoznik 2019-05-14 10:39:27 +02:00
parent 0cf3bb805c
commit aa308f7ffc

View 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;