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

Re: [Xen-devel] [PATCH 1/2] x86: fix memory leak in pvh_setup_acpi_madt



On Sun, Feb 26, 2017 at 03:49:31PM +0000, Wei Liu wrote:
> Switch to use goto style error handling to avoid leaking madt.

Thanks, I guess it's fine to don't leak memory here, but in any case this is
doomed to fail, no further progress is going to be made if Dom0 build fails,
hence that's why memory leaks here are not really meaningful.

> Coverity-ID: 1401534
> 
> Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>

Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

> ---
>  xen/arch/x86/domain_build.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/xen/arch/x86/domain_build.c b/xen/arch/x86/domain_build.c
> index 0534838c8e..1f18f9283f 100644
> --- a/xen/arch/x86/domain_build.c
> +++ b/xen/arch/x86/domain_build.c
> @@ -2290,7 +2290,8 @@ static int __init pvh_setup_acpi_madt(struct domain *d, 
> paddr_t *addr)
>      if ( !madt )
>      {
>          printk("Unable to allocate memory for MADT table\n");
> -        return -ENOMEM;
> +        rc = -ENOMEM;
> +        goto out;

This one doesn't need the goto, there's nothing leaked here (although there's
also no problem in doing in that way).

Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.