[PATCH] arm: Fix possible memory leak

Stefan Weil weil at mail.berlios.de
Sun Jan 30 14:26:27 EST 2011


sr_info was allocated and needs a kfree before returning.

This error was reported by cppcheck:
arch/arm/mach-omap2/smartreflex.c:837: error: Memory leak: sr_info

To: Tony Lindgren <tony at atomide.com>
Cc: Russell King <linux at arm.linux.org.uk>
Cc: linux-omap at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
Signed-off-by: Stefan Weil <weil at mail.berlios.de>
---
 arch/arm/mach-omap2/smartreflex.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index af39d17..07324607 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -832,7 +832,8 @@ static int __init omap_sr_probe(struct platform_device *pdev)

 	if (!pdata) {
 		dev_err(&pdev->dev, "%s: platform data missing\n", __func__);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err_free_devinfo;
 	}

 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
--
1.7.2.3




More information about the linux-arm-kernel mailing list