From: Catalin Marinas Date: Fri, 14 Jul 2006 07:23:59 +0000 (-0700) Subject: [PATCH] Fix a memory leak in the i386 setup code X-Git-Tag: v2.6.18-rc2~66 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7546075e7c08821732fa04119a9005c55ab432d;p=linux-2.6 [PATCH] Fix a memory leak in the i386 setup code Signed-off-by: Catalin Marinas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index 7864395c14..f1682206d3 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c @@ -1327,7 +1327,10 @@ legacy_init_iomem_resources(struct resource *code_resource, struct resource *dat 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,