From: Ben Skeggs <bskeggs@redhat.com>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: David Airlie <airlied@linux.ie>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/nouveau: avoid memory leak
Date: Wed, 18 Jun 2014 19:24:30 -0400 (EDT) [thread overview]
Message-ID: <1687970626.38938809.1403133870580.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1403121467-27309-1-git-send-email-xypron.glpk@gmx.de>
----- Original Message -----
> From: "Heinrich Schuchardt" <xypron.glpk@gmx.de>
> To: "David Airlie" <airlied@linux.ie>
> Cc: "Ben Skeggs" <bskeggs@redhat.com>, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, "Heinrich
> Schuchardt" <xypron.glpk@gmx.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@gmx.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
>
>
prev parent reply other threads:[~2014-06-18 23:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 19:57 Heinrich Schuchardt
2014-06-18 23:24 ` Ben Skeggs [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1687970626.38938809.1403133870580.JavaMail.zimbra@redhat.com \
--to=bskeggs@redhat.com \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xypron.glpk@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome