lkml.org 
[lkml]   [2010]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 3/4] [ARM] pxamci: fix a memory leak
From
Date
request_mem_region() will call kzalloc to allocate memory for struct resource.
release_resource() unregisters the resource but does not free the allocated
memory, thus use release_mem_region() instead to fix the memory leak.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/mmc/host/pxamci.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index 7257738..d98e647 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -774,7 +774,7 @@ err_gpio_ro:
}
if (mmc)
mmc_free_host(mmc);
- release_resource(r);
+ release_mem_region(r->start, SZ_4K);
return ret;
}

@@ -824,7 +824,7 @@ static int pxamci_remove(struct platform_device *pdev)

clk_put(host->clk);

- release_resource(host->res);
+ release_mem_region(host->res->start, SZ_4K);

mmc_free_host(mmc);
}
--
1.7.2




\
 
 \ /
  Last update: 2010-11-22 09:43    [from the cache]
©2003-2011 Jasper Spaans