aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/kernel
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2012-09-02 10:23:59 -0400
committerHelge Deller <deller@gmx.de>2013-02-20 16:47:11 -0500
commitfbd48433e79a6439264448c8e85c4816f5b32694 (patch)
treecbce034b8d2b7be661d787f6139956c0d1315e5c /arch/parisc/kernel
parentec758f98328da3eb933a25dc7a2eed01ef44d849 (diff)
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.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/parisc/kernel/inventory.c b/arch/parisc/kernel/inventory.c
index 08324aac3544..3295ef4a185d 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)
186 186
187 if (status != PDC_OK) { 187 if (status != PDC_OK) {
188 /* no more cell modules or error */ 188 /* no more cell modules or error */
189 kfree(pa_pdc_cell);
189 return status; 190 return status;
190 } 191 }
191 192
192 temp = pa_pdc_cell->cba; 193 temp = pa_pdc_cell->cba;
193 dev = alloc_pa_dev(PAT_GET_CBA(temp), &(pa_pdc_cell->mod_path)); 194 dev = alloc_pa_dev(PAT_GET_CBA(temp), &(pa_pdc_cell->mod_path));
194 if (!dev) { 195 if (!dev) {
196 kfree(pa_pdc_cell);
195 return PDC_OK; 197 return PDC_OK;
196 } 198 }
197 199