[libvirt] [PATCH V1 2/5] qemu: fix resource leak
Osier Yang
jyang at redhat.com
Fri May 4 13:55:07 UTC 2012
On 2012年05月04日 19:54, Stefan Berger wrote:
> 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.
>
> ---
> src/qemu/qemu_driver.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> Index: libvirt-acl/src/qemu/qemu_driver.c
> ===================================================================
> --- libvirt-acl.orig/src/qemu/qemu_driver.c
> +++ libvirt-acl/src/qemu/qemu_driver.c
> @@ -6991,6 +6991,9 @@ qemuDomainGetNumaParameters(virDomainPtr
> if (virTypedParameterAssign(param, VIR_DOMAIN_NUMA_NODESET,
> VIR_TYPED_PARAM_STRING, nodeset)< 0)
> goto cleanup;
> +
> + nodeset = NULL;
> +
> break;
>
> default:
> @@ -7004,6 +7007,7 @@ qemuDomainGetNumaParameters(virDomainPtr
> ret = 0;
>
> cleanup:
> + VIR_FREE(nodeset);
> virCgroupFree(&group);
> if (vm)
> virDomainObjUnlock(vm);
>
> --
ACK
Osier
More information about the libvir-list
mailing list