Skip to content

Commit

Permalink
omap iommu: Fix Memory leak
Browse files Browse the repository at this point in the history
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 <x0124230@ti.com>
Signed-off-by: Manjunatha GK <manjugk@ti.com>
Cc: Vimal Singh <vimal.newwork@gmail.com>
Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Signed-off-by: Tony Lindgen <tony@atomide.com>
  • Loading branch information
Satish authored and Tony Lindgren committed Jun 9, 2010
1 parent 386f40c commit 7f1225b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/arm/plat-omap/iovmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 7f1225b

Please sign in to comment.