Skip to contentSkip to conversation

DRM: TTM: Fix memory leak issue in ttm_agp_tt_create().

PATCH In review Manjunath Goudar 2 participants 2 messages Sep 4, 2013 – Sep 6, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 DRM: TTM: Fix memory leak issue in ttm_agp_tt_create().

From: Jeyaraman R <[email protected]>

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.

Cc David Airlie <[email protected]>
Cc "Paul E. McKenney" <[email protected]>
Cc David Howells <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Dave Jones <[email protected]>
Cc Dave Airlie <[email protected]>
---
 drivers/gpu/drm/ttm/ttm_agp_backend.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/ttm/ttm_agp_backend.c +1 -0
index 3302f99..764be36 100644
@@ -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;
 	}
 
Signature · 1 line
1.8.1.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Manjunath Goudar

From: Jeyaraman R <[email protected]>

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.

Quoted 10 lines
Cc David Airlie <[email protected]>
Cc "Paul E. McKenney" <[email protected]>
Cc David Howells <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Dave Jones <[email protected]>
Cc Dave Airlie <[email protected]>
Quoted 23 lines
---
 drivers/gpu/drm/ttm/ttm_agp_backend.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/ttm/ttm_agp_backend.c +1 -0
index 3302f99..764be36 100644
@@ -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;
 	}
 
Signature · 6 lines
1.8.1.2

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel