[PATCH] drivers/misc: fix a memory leak in spear_pcie_gadget_probeerror path

From: Axel Lin
Date: Tue May 24 2011 - 23:24:08 EST


In the case of goto err_kzalloc, we should kfree target.

Signed-off-by: Axel Lin <axel.lin@xxxxxxxxx>
---
drivers/misc/spear13xx_pcie_gadget.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/misc/spear13xx_pcie_gadget.c b/drivers/misc/spear13xx_pcie_gadget.c
index 7aded90..cfbddbe 100644
--- a/drivers/misc/spear13xx_pcie_gadget.c
+++ b/drivers/misc/spear13xx_pcie_gadget.c
@@ -845,7 +845,7 @@ err_iounmap:
err_iounmap_app:
iounmap(config->va_app_base);
err_kzalloc:
- kfree(config);
+ kfree(target);
err_rel_res:
release_mem_region(res1->start, resource_size(res1));
err_rel_res0:
--
1.7.1



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/