On 10/1/21 2:12 PM, William Douglas wrote:
Signed-off-by: William Douglas <william.doug...@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();

there should be an extra empy line here between variable definition and the start of instructions.

          if (virJSONValueObjectAppendNumberUlong(memory, "size", total_memory) 
< 0)
-            goto cleanup;
+            return -1;

also an empty line here makes the code more readable.

          if (virJSONValueObjectAppend(content, "memory", &memory) < 0)
-            goto cleanup;
+            return -1;
      }
return 0;
-
- cleanup:
-    virJSONValueFree(memory);
-    return -1;
  }
static int


Reviewed-by: Laine Stump <la...@redhat.com>

I'll add the extra empty lines before pushing.

Reply via email to