Signed-off-by: William Douglas <william.douglas(a)intel.com>
---
src/ch/ch_monitor.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c
index 800457af41..7326ac645b 100644
--- a/src/ch/ch_monitor.c
+++ b/src/ch/ch_monitor.c
@@ -154,22 +154,17 @@ virCHMonitorBuildKernelRelatedJson(virJSONValue *content,
virDomainDef *vmdef)
static int
virCHMonitorBuildMemoryJson(virJSONValue *content, virDomainDef *vmdef)
{
- virJSONValue *memory;
unsigned long long total_memory = virDomainDefGetMemoryInitial(vmdef) * 1024;
if (total_memory != 0) {
- memory = virJSONValueNewObject();
+ g_autoptr(virJSONValue) memory = virJSONValueNewObject();
if (virJSONValueObjectAppendNumberUlong(memory, "size", total_memory)
< 0)
- goto cleanup;
+ return -1;
if (virJSONValueObjectAppend(content, "memory", &memory) < 0)
- goto cleanup;
+ return -1;
}
return 0;
-
- cleanup:
- virJSONValueFree(memory);
- return -1;
}
static int
--
2.33.0