From: Satish Date: Wed, 9 Jun 2010 10:21:27 +0000 (+0300) Subject: omap iommu: Fix Memory leak X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7f1225bd6e62c54edfa0a2464648ad9e4efb1313;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git 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 --- 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);