public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/ttm: Fix memory leak in ttm_agp_backend.c
@ 2014-02-12 13:46 Masanari Iida
  2014-02-13 12:10 ` Thomas Hellstrom
  0 siblings, 1 reply; 2+ messages in thread
From: Masanari Iida @ 2014-02-12 13:46 UTC (permalink / raw)
  To: linux-kernel, dri-devel, airlied; +Cc: Masanari Iida

This patch fix a memory leak found by cppcheck.
[drivers/gpu/drm/ttm/ttm_agp_backend.c:129]:
(error) Memory leak: agp_be

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
---
 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.9.rc1


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

* Re: [PATCH] drm/ttm: Fix memory leak in ttm_agp_backend.c
  2014-02-12 13:46 [PATCH] drm/ttm: Fix memory leak in ttm_agp_backend.c Masanari Iida
@ 2014-02-13 12:10 ` Thomas Hellstrom
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Hellstrom @ 2014-02-13 12:10 UTC (permalink / raw)
  To: Masanari Iida; +Cc: linux-kernel, dri-devel, airlied

On 02/12/2014 02:46 PM, Masanari Iida wrote:
> This patch fix a memory leak found by cppcheck.
> [drivers/gpu/drm/ttm/ttm_agp_backend.c:129]:
> (error) Memory leak: agp_be
>
> Signed-off-by: Masanari Iida <standby24x7@gmail.com>
> ---
>  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;
>  	}
>  

Thanks, I'll include in the next ttm-fixes pull request.

/Thomas




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

end of thread, other threads:[~2014-02-13 12:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-12 13:46 [PATCH] drm/ttm: Fix memory leak in ttm_agp_backend.c Masanari Iida
2014-02-13 12:10 ` Thomas Hellstrom

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