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 <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Peter Krempa 2019-03-29 09:32:14 +01:00
parent f7550ecce8
commit 78ad4c559e

View File

@ -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)