From: Jeyaraman R <jeyaraman.rangas...@lge.com> 

This patch adds kfree() in ttm_agp_tt_create() to avoide the
memory leak, without this there is a chance of memory leak in
ttm_tt_init() fail case.

Signed-off-by: Jeyaraman R <jeyaraman.rangas...@lge.com>
Signed-off-by: Manjunath Goudar <manjunath.gou...@linaro.org>
Cc: David Airlie <airl...@linux.ie>
Cc: "Paul E. McKenney" <paul...@linux.vnet.ibm.com>
Cc: David Howells <dhowe...@redhat.com>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: Dave Jones <da...@redhat.com>
Cc: Dave Airlie <airl...@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-ker...@vger.kernel.org
---
 drivers/gpu/drm/ttm/ttm_agp_backend.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/ttm/ttm_agp_backend.c 
b/drivers/gpu/drm/ttm/ttm_agp_backend.c
index 3302f99..764be36 100644
--- a/drivers/gpu/drm/ttm/ttm_agp_backend.c
+++ b/drivers/gpu/drm/ttm/ttm_agp_backend.c
@@ -126,6 +126,7 @@ struct ttm_tt *ttm_agp_tt_create(struct ttm_bo_device *bdev,
        agp_be->ttm.func = &ttm_agp_func;
 
        if (ttm_tt_init(&agp_be->ttm, bdev, size, page_flags, dummy_read_page)) 
{
+               kfree(agp_be);
                return NULL;
        }
 
-- 
1.8.1.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to