[libvirt] [PATCH v2 5/5] vmx: avoid memory leak

Eric Blake eblake at redhat.com
Mon Sep 19 19:48:46 UTC 2011


On 09/18/2011 08:34 PM, ajia at redhat.com wrote:
> * src/vmx/vmx.c: fix memory leak, 'def' has a initial value 'NULL', so
>    'goto cleanup' is perfected instead of adding a virConfFree before
>    'return NULL'.
>
> Signed-off-by: Alex Jia<ajia at redhat.com>
> ---
>   src/vmx/vmx.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
> index dff3599..be91c13 100644
> --- a/src/vmx/vmx.c
> +++ b/src/vmx/vmx.c
> @@ -1253,7 +1253,7 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx)
>       /* Allocate domain def */
>       if (VIR_ALLOC(def)<  0) {
>           virReportOOMError();
> -        return NULL;
> +        goto cleanup;

ACK and pushed.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list