[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1687970626.38938809.1403133870580.JavaMail.zimbra@redhat.com>
Date: Wed, 18 Jun 2014 19:24:30 -0400 (EDT)
From: Ben Skeggs <bskeggs@...hat.com>
To: Heinrich Schuchardt <xypron.glpk@....de>
Cc: David Airlie <airlied@...ux.ie>, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/nouveau: avoid memory leak
----- Original Message -----
> From: "Heinrich Schuchardt" <xypron.glpk@....de>
> To: "David Airlie" <airlied@...ux.ie>
> Cc: "Ben Skeggs" <bskeggs@...hat.com>, dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org, "Heinrich
> Schuchardt" <xypron.glpk@....de>
> Sent: Thursday, 19 June, 2014 5:57:47 AM
> Subject: [PATCH] drm/nouveau: avoid memory leak
>
> If ttm_dma_tt_init fails memory is leaked.
No, it's not. TTM calls the destroy function itself on failure.
Thanks,
Ben.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@....de>
> ---
> drivers/gpu/drm/nouveau/nouveau_sgdma.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c
> b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
> index a4d22e5..23d880b 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
> @@ -109,7 +109,9 @@ nouveau_sgdma_create_ttm(struct ttm_bo_device *bdev,
> else
> nvbe->ttm.ttm.func = &nv50_sgdma_backend;
>
> - if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page))
> + if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page)) {
> + kfree(nvbe);
> return NULL;
> + }
> return &nvbe->ttm.ttm;
> }
> --
> 2.0.0
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists