Re: [PATCH 1/5] ch_monitor: Stop leaking json value objects

2021-10-03 Thread Laine Stump

On 10/1/21 2:12 PM, William Douglas wrote:

In virCHMonitorBuildKernelRelatedJson there are two cases of json
value objects being lost after the pointer being redefined. This
change removes the needless redefinition.

Signed-off-by: William Douglas 


Reviewed-by: Laine Stump 



[PATCH 1/5] ch_monitor: Stop leaking json value objects

2021-10-01 Thread William Douglas
In virCHMonitorBuildKernelRelatedJson there are two cases of json
value objects being lost after the pointer being redefined. This
change removes the needless redefinition.

Signed-off-by: William Douglas 
---
 src/ch/ch_monitor.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c
index 5ed26a574f..a1430f0e65 100644
--- a/src/ch/ch_monitor.c
+++ b/src/ch/ch_monitor.c
@@ -121,7 +121,6 @@ virCHMonitorBuildKernelRelatedJson(virJSONValue *content, 
virDomainDef *vmdef)
_("Kernel image path in this domain is not defined"));
 goto cleanup;
 } else {
-kernel = virJSONValueNewObject();
 if (virJSONValueObjectAppendString(kernel, "path", vmdef->os.kernel) < 
0)
 goto cleanup;
 if (virJSONValueObjectAppend(content, "kernel", ) < 0)
@@ -136,7 +135,6 @@ virCHMonitorBuildKernelRelatedJson(virJSONValue *content, 
virDomainDef *vmdef)
 }
 
 if (vmdef->os.initrd != NULL) {
-initramfs = virJSONValueNewObject();
 if (virJSONValueObjectAppendString(initramfs, "path", 
vmdef->os.initrd) < 0)
 goto cleanup;
 if (virJSONValueObjectAppend(content, "initramfs", ) < 0)
-- 
2.33.0