Re: [PATCH] staging: omapdrm/omap_gem_dmabuf.c: fix memory leakage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/15/2013 01:46 PM, Cong Ding wrote:
There is a memory leakage in variable sg if it goes to error.

Signed-off-by: Cong Ding <dinggnu@xxxxxxxxx>

Signed-off-by: Rob Clark <rob@xxxxxx>

---
  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,

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux