mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
ch: use g_auto in virCHMonitorBuildNetsJson
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
08b943d641
commit
b4436cc3f5
@ -345,7 +345,7 @@ virCHMonitorBuildNetJson(virJSONValue *nets, virDomainNetDef *netdef)
|
|||||||
static int
|
static int
|
||||||
virCHMonitorBuildNetsJson(virJSONValue *content, virDomainDef *vmdef)
|
virCHMonitorBuildNetsJson(virJSONValue *content, virDomainDef *vmdef)
|
||||||
{
|
{
|
||||||
virJSONValue *nets;
|
g_autoptr(virJSONValue) nets = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (vmdef->nnets > 0) {
|
if (vmdef->nnets > 0) {
|
||||||
@ -353,17 +353,13 @@ virCHMonitorBuildNetsJson(virJSONValue *content, virDomainDef *vmdef)
|
|||||||
|
|
||||||
for (i = 0; i < vmdef->nnets; i++) {
|
for (i = 0; i < vmdef->nnets; i++) {
|
||||||
if (virCHMonitorBuildNetJson(nets, vmdef->nets[i]) < 0)
|
if (virCHMonitorBuildNetJson(nets, vmdef->nets[i]) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
if (virJSONValueObjectAppend(content, "net", &nets) < 0)
|
if (virJSONValueObjectAppend(content, "net", &nets) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
virJSONValueFree(nets);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user