[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



2011/9/18  <ajia redhat com>:
> * src/vmx/vmx.c: fix memory leak.
>
> Signed-off-by: Alex Jia <ajia redhat com>
> ---
>  src/vmx/vmx.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
> index dff3599..1ab15b7 100644
> --- a/src/vmx/vmx.c
> +++ b/src/vmx/vmx.c
> @@ -1253,6 +1253,7 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx)
>     /* Allocate domain def */
>     if (VIR_ALLOC(def) < 0) {
>         virReportOOMError();
> +        virConfFree(conf);
>         return NULL;
>     }

Your patch is correct.

But I'd suggest to replace the 'return NULL' with a 'goto cleanup'
here instead of adding a virConfFree, as this is more in line with the
surrounding code.

Either way ACK.

-- 
Matthias Bolte
http://photron.blogspot.com


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]