Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
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 174ea47c51..d268dc3c90 100644
--- a/src/ch/ch_monitor.c
+++ b/src/ch/ch_monitor.c
@@ -211,7 +211,7 @@ virCHMonitorBuildDiskJson(virJSONValue *disks, virDomainDiskDef
*diskdef)
static int
virCHMonitorBuildDisksJson(virJSONValue *content, virDomainDef *vmdef)
{
- virJSONValue *disks;
+ g_autoptr(virJSONValue) disks = NULL;
size_t i;
if (vmdef->ndisks > 0) {
@@ -219,17 +219,13 @@ virCHMonitorBuildDisksJson(virJSONValue *content, virDomainDef
*vmdef)
for (i = 0; i < vmdef->ndisks; i++) {
if (virCHMonitorBuildDiskJson(disks, vmdef->disks[i]) < 0)
- goto cleanup;
+ return -1;
}
if (virJSONValueObjectAppend(content, "disks", &disks) < 0)
- goto cleanup;
+ return -1;
}
return 0;
-
- cleanup:
- virJSONValueFree(disks);
- return -1;
}
static int
--
2.31.1