From 7f1225bd6e62c54edfa0a2464648ad9e4efb1313 Mon Sep 17 00:00:00 2001 From: Satish Date: Wed, 9 Jun 2010 13:21:27 +0300 Subject: [PATCH] omap iommu: Fix Memory leak The memory allocated for sgt structure is not freed on error when sg_alloc_table is called in sgtable_alloc(). Signed-off-by: Satish Kumar Signed-off-by: Manjunatha GK Cc: Vimal Singh Signed-off-by: Hiroshi DOYU Signed-off-by: Tony Lindgen --- arch/arm/plat-omap/iovmm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/plat-omap/iovmm.c b/arch/arm/plat-omap/iovmm.c index e43983ba59c5..8ce0de247c71 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); -- 2.20.1