public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: omapdrm/omap_gem_dmabuf.c: fix memory leakage
@ 2013-01-15 19:46 Cong Ding
  2013-01-15 21:14 ` Rob Clark
  0 siblings, 1 reply; 2+ messages in thread
From: Cong Ding @ 2013-01-15 19:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Clark, Seung-Woo Kim, Andrew Morton,
	YAMANE Toshiaki, devel, linux-kernel
  Cc: Cong Ding

There is a memory leakage in variable sg if it goes to error.

Signed-off-by: Cong Ding <dinggnu@gmail.com>
---
 drivers/staging/omapdrm/omap_gem_dmabuf.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/omapdrm/omap_gem_dmabuf.c b/drivers/staging/omapdrm/omap_gem_dmabuf.c
index b6c5b5c..a3236ab 100644
--- a/drivers/staging/omapdrm/omap_gem_dmabuf.c
+++ b/drivers/staging/omapdrm/omap_gem_dmabuf.c
@@ -53,10 +53,10 @@ static struct sg_table *omap_gem_map_dma_buf(
 	/* this should be after _get_paddr() to ensure we have pages attached */
 	omap_gem_dma_sync(obj, dir);
 
-out:
-	if (ret)
-		return ERR_PTR(ret);
 	return sg;
+out:
+	kfree(sg);
+	return ERR_PTR(ret);
 }
 
 static void omap_gem_unmap_dma_buf(struct dma_buf_attachment *attachment,
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-15 21:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-15 19:46 [PATCH] staging: omapdrm/omap_gem_dmabuf.c: fix memory leakage Cong Ding
2013-01-15 21:14 ` Rob Clark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox