From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: Jesper Juhl <jj@chaosbits.net>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
David Airlie <airlied@linux.ie>,
Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: Re: [PATCH] drm/i915/sprite: Fix mem leak in intel_plane_init()
Date: Tue, 26 Jun 2012 17:12:46 -0700 [thread overview]
Message-ID: <20120626171246.4c385996@jbarnes-desktop> (raw)
In-Reply-To: <alpine.LNX.2.00.1206270053570.3759@swampdragon.chaosbits.net>
On Wed, 27 Jun 2012 00:55:37 +0200 (CEST)
Jesper Juhl <jj@chaosbits.net> wrote:
> If we ever hit the default case in the switch statement we'll return
> from the function without freeing the memory we just allocated to
> 'intel_plane' (but that has not been used).
>
> This patch gets rid of the leak by freeing the memory just before we
> return.
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
> drivers/gpu/drm/i915/intel_sprite.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 2a20fb0..c8851ba 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -685,6 +685,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe)
> break;
>
> default:
> + kfree(intel_plane);
> return -ENODEV;
> }
>
> @@ -699,4 +700,3 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe)
>
> return ret;
> }
Yeah, looks fine. I just fixed the same thing in a local tree (though
by using a goto since I added another path that could fail).
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
--
Jesse Barnes, Intel Open Source Technology Center
next prev parent reply other threads:[~2012-06-27 0:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-26 22:55 [PATCH] drm/i915/sprite: Fix mem leak in intel_plane_init() Jesper Juhl
2012-06-27 0:12 ` Jesse Barnes [this message]
2012-06-27 11:36 ` Daniel Vetter
2012-06-27 8:34 ` Chris Wilson
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=20120626171246.4c385996@jbarnes-desktop \
--to=jbarnes@virtuousgeek.org \
--cc=airlied@linux.ie \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jj@chaosbits.net \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.