Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/ch/ch_monitor.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index 21f8cb6782..aa27eea304 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -334,7 +334,7 @@ virCHMonitorBuildNetJson(virJSONValue *nets, virDomainNetDef *netdef) static int virCHMonitorBuildNetsJson(virJSONValue *content, virDomainDef *vmdef) { - virJSONValue *nets; + g_autoptr(virJSONValue) nets = NULL; size_t i; if (vmdef->nnets > 0) { @@ -342,17 +342,13 @@ virCHMonitorBuildNetsJson(virJSONValue *content, virDomainDef *vmdef) 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 -- 2.31.1