From: Michal Privoznik Date: Tue, 14 May 2019 08:39:27 +0000 (+0200) Subject: virNetServerPreExecRestart: Check for retval of virJSONValueNewArray() X-Git-Tag: v5.4.0-rc1~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa308f7ffcf156faf69fa40190399486d38ec647;p=thirdparty%2Flibvirt.git virNetServerPreExecRestart: Check for retval of virJSONValueNewArray() Signed-off-by: Michal Privoznik Reviewed-by: Erik Skultety --- diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c index 83b871764f..4934dba967 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -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;