Re: [PATCH] Fix a memory leak in the i386 setup code

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

 



Hi,

Does x86_64 need a similar fix?

On Tuesday 11 July 2006 00:13, Catalin Marinas wrote:
> From: Catalin Marinas <[email protected]>
> 
> Signed-off-by: Catalin Marinas <[email protected]>
> ---
> 
>  arch/i386/kernel/setup.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
> index 08c00d2..d32d264 100644
> --- a/arch/i386/kernel/setup.c
> +++ b/arch/i386/kernel/setup.c
> @@ -1327,7 +1327,10 @@ #endif
>  		res->start = e820.map[i].addr;
>  		res->end = res->start + e820.map[i].size - 1;
>  		res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
> -		request_resource(&iomem_resource, res);
> +		if (request_resource(&iomem_resource, res)) {
> +			kfree(res);
> +			continue;
> +		}
>  		if (e820.map[i].type == E820_RAM) {
>  			/*
>  			 *  We don't know which RAM region contains kernel data,
> -

Evidently res is used if e820.map[i].type == E820_RAM, so it should
be freed later on, it seems.

Greetings,
Rafael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux