From ab26f4e372b8bbe7953db176d5837d9cf70b85ab Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Fri, 4 May 2012 10:42:09 -0400 Subject: [PATCH] qemu: fix resource leak Error: RESOURCE_LEAK: /libvirt/src/qemu/qemu_driver.c:6968: alloc_fn: Calling allocation function "calloc". /libvirt/src/qemu/qemu_driver.c:6968: var_assign: Assigning: "nodeset" = storage returned from "calloc(1UL, 1UL)". /libvirt/src/qemu/qemu_driver.c:6977: noescape: Variable "nodeset" is not freed or pointed-to in function "virTypedParameterAssign". /libvirt/src/qemu/qemu_driver.c:6997: leaked_storage: Variable "nodeset" going out of scope leaks the storage it points to. (cherry picked from commit c0774482ff9d0689e13eab5bed1da69867dd1902) --- src/qemu/qemu_driver.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 186bc21bae..2582dadf2e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6973,6 +6973,9 @@ qemuDomainGetNumaParameters(virDomainPtr dom, if (virTypedParameterAssign(param, VIR_DOMAIN_NUMA_NODESET, VIR_TYPED_PARAM_STRING, nodeset) < 0) goto cleanup; + + nodeset = NULL; + break; default: @@ -6986,6 +6989,7 @@ qemuDomainGetNumaParameters(virDomainPtr dom, ret = 0; cleanup: + VIR_FREE(nodeset); virCgroupFree(&group); if (vm) virDomainObjUnlock(vm);