[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20120627113608.GC5326@phenom.ffwll.local>
Date: Wed, 27 Jun 2012 13:36:09 +0200
From: Daniel Vetter <daniel@...ll.ch>
To: Jesse Barnes <jbarnes@...tuousgeek.org>
Cc: Jesper Juhl <jj@...osbits.net>, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org, David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel.vetter@...ll.ch>
Subject: Re: [PATCH] drm/i915/sprite: Fix mem leak in intel_plane_init()
On Tue, Jun 26, 2012 at 05:12:46PM -0700, Jesse Barnes wrote:
> On Wed, 27 Jun 2012 00:55:37 +0200 (CEST)
> Jesper Juhl <jj@...osbits.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@...osbits.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@...tuousgeek.org>
Queued for -next, thanks for the patch.
-Daniel
--
Daniel Vetter
Mail: daniel@...ll.ch
Mobile: +41 (0)79 365 57 48
--
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