diff mbox

OMAP: Fix Memory leak

Message ID 1274365792-24938-4-git-send-email-manjugk@ti.com (mailing list archive)
State Changes Requested
Delegated to: Tony Lindgren
Headers show

Commit Message

manjugk manjugk May 20, 2010, 2:29 p.m. UTC
None
diff mbox

Patch

diff --git a/arch/arm/plat-omap/iovmm.c b/arch/arm/plat-omap/iovmm.c
index e43983b..8ce0de2 100644
--- a/arch/arm/plat-omap/iovmm.c
+++ b/arch/arm/plat-omap/iovmm.c
@@ -140,8 +140,10 @@  static struct sg_table *sgtable_alloc(const size_t bytes, u32 flags)
 		return ERR_PTR(-ENOMEM);
 
 	err = sg_alloc_table(sgt, nr_entries, GFP_KERNEL);
-	if (err)
+	if (err) {
+		kfree(sgt);
 		return ERR_PTR(err);
+	}
 
 	pr_debug("%s: sgt:%p(%d entries)\n", __func__, sgt, nr_entries);