]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
ch_monitor: Stop leaking json value objects
authorWilliam Douglas <william.douglas@intel.com>
Fri, 1 Oct 2021 18:12:33 +0000 (11:12 -0700)
committerLaine Stump <laine@redhat.com>
Tue, 5 Oct 2021 04:07:23 +0000 (00:07 -0400)
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 <william.douglas@intel.com>
Reviewed-by: Laine Stump <laine@redhat.com>
src/ch/ch_monitor.c

index 5ed26a574fc4b6e3846ac314dcb3c68ca8daf6a9..a1430f0e65a5f8270a845568d13f7ac4b1f81fc3 100644 (file)
@@ -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", &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", &initramfs) < 0)