[libvirt] [PATCH] qemu_monitor_json.c: avoid an unconditional leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Calling virJSONValueFree does not free the memory allocated via this:

    cmd = qemuMonitorJSONMakeCommand("drive_add",
                                     "s:pci_addr", dev,
                                     "s:opts", drivestr,
                                     NULL);

so I added the VIR_FREE:

>From 1d272e070b66fc16e2fcc23002879ee268a58a5f Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
Date: Wed, 27 Jan 2010 09:58:12 +0100
Subject: [PATCH] qemu_monitor_json.c: avoid an unconditional leak

* src/qemu/qemu_monitor_json.c (qemuMonitorJSONAttachDrive):
Don't leak the buffer behind a virJSONValuePtr.
---
 src/qemu/qemu_monitor_json.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 8e88c7e..0f970bb 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -1773,6 +1773,7 @@ int qemuMonitorJSONAttachDrive(qemuMonitorPtr mon,
         ret = -1;

     virJSONValueFree(cmd);
+    VIR_FREE(cmd);
     virJSONValueFree(reply);
     return ret;
 }
--
1.7.0.rc0.140.gfbe7

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]