[PATCH 4/6] qemu: caps: Don't leak package name string in virQEMUCapsInitQMPMonitor

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

 



If the detected qemu version is below our required version 'package'
would be leaked.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_capabilities.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 4c52dfc714..e3db7ce71c 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4322,7 +4322,7 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
 {
     int ret = -1;
     int major, minor, micro;
-    char *package = NULL;
+    VIR_AUTOFREE(char *) package = NULL;

     /* @mon is supposed to be locked by callee */

@@ -4347,7 +4347,7 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
     }

     qemuCaps->version = major * 1000000 + minor * 1000 + micro;
-    qemuCaps->package = package;
+    VIR_STEAL_PTR(qemuCaps->package, package);
     qemuCaps->usedQMP = true;

     if (virQEMUCapsInitQMPArch(qemuCaps, mon) < 0)
-- 
2.20.1

--
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]

  Powered by Linux