diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2012-09-02 14:23:59 (GMT) |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2013-02-20 21:47:11 (GMT) |
commit | fbd48433e79a6439264448c8e85c4816f5b32694 (patch) | |
tree | cbce034b8d2b7be661d787f6139956c0d1315e5c /arch/parisc/kernel | |
parent | ec758f98328da3eb933a25dc7a2eed01ef44d849 (diff) | |
download | linux-fbd48433e79a6439264448c8e85c4816f5b32694.tar.xz |
parisc: fix possible memory leak in pat_query_module()
pa_pdc_cell has been allocated in this function and so should be
freed before leaving from the error handling cases.
spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'arch/parisc/kernel')
-rw-r--r-- | arch/parisc/kernel/inventory.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/parisc/kernel/inventory.c b/arch/parisc/kernel/inventory.c index 08324aa..3295ef4 100644 --- a/arch/parisc/kernel/inventory.c +++ b/arch/parisc/kernel/inventory.c @@ -186,12 +186,14 @@ pat_query_module(ulong pcell_loc, ulong mod_index) if (status != PDC_OK) { /* no more cell modules or error */ + kfree(pa_pdc_cell); return status; } temp = pa_pdc_cell->cba; dev = alloc_pa_dev(PAT_GET_CBA(temp), &(pa_pdc_cell->mod_path)); if (!dev) { + kfree(pa_pdc_cell); return PDC_OK; } |