From 78ad4c559e00f1a86bafd3b8102bcb467f80d95d Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 29 Mar 2019 09:32:14 +0100 Subject: [PATCH] qemu: caps: Don't leak package name string in virQEMUCapsInitQMPMonitor If the detected qemu version is below our required version 'package' would be leaked. Signed-off-by: Peter Krempa Reviewed-by: Erik Skultety --- 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)