linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch v2] drm/tegra: fix small leak on error in tegra_fb_alloc()
@ 2013-11-12 10:25 Dan Carpenter
       [not found] ` <20131112102526.GA10651-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-11-12 10:25 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Terje Bergström, Stephen Warren, kernel-janitors, dri-devel,
	linux-tegra

If we don't have enough memory for ->planes then we leak "fb".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: tiny style changes

diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c
index 490f771..f9d2de6 100644
--- a/drivers/gpu/drm/tegra/fb.c
+++ b/drivers/gpu/drm/tegra/fb.c
@@ -98,8 +98,10 @@ static struct tegra_fb *tegra_fb_alloc(struct drm_device *drm,
 		return ERR_PTR(-ENOMEM);
 
 	fb->planes = kzalloc(num_planes * sizeof(*planes), GFP_KERNEL);
-	if (!fb->planes)
+	if (!fb->planes) {
+		kfree(fb);
 		return ERR_PTR(-ENOMEM);
+	}
 
 	fb->num_planes = num_planes;

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

* Re: [patch v2] drm/tegra: fix small leak on error in tegra_fb_alloc()
       [not found] ` <20131112102526.GA10651-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
@ 2013-12-03 10:10   ` Thierry Reding
  0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2013-12-03 10:10 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Terje Bergström, David Airlie, Stephen Warren,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 286 bytes --]

On Tue, Nov 12, 2013 at 01:25:26PM +0300, Dan Carpenter wrote:
> If we don't have enough memory for ->planes then we leak "fb".
> 
> Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> ---
> v2: tiny style changes

Applied, thanks.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2013-12-03 10:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-12 10:25 [patch v2] drm/tegra: fix small leak on error in tegra_fb_alloc() Dan Carpenter
     [not found] ` <20131112102526.GA10651-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
2013-12-03 10:10   ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).