mirror of https://gitee.com/openkylin/libvirt.git
rpc: Avoid resource leak of 'socks' if any object append fails
This commit is contained in:
parent
4f85cfdfad
commit
af3262e26f
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue