Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
static int
virCHMonitorBuildNetsJson(virJSONValue *content, virDomainDef *vmdef)
{
- virJSONValue *nets;
+ g_autoptr(virJSONValue) nets = NULL;
size_t i;
if (vmdef->nnets > 0) {
for (i = 0; i < vmdef->nnets; i++) {
if (virCHMonitorBuildNetJson(nets, vmdef->nets[i]) < 0)
- goto cleanup;
+ return -1;
}
if (virJSONValueObjectAppend(content, "net", &nets) < 0)
- goto cleanup;
+ return -1;
}
return 0;
-
- cleanup:
- virJSONValueFree(nets);
- return -1;
}
static int