All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] nouveau: fix memory leak
@ 2010-04-07  9:33 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2010-04-07  9:33 UTC (permalink / raw)
  To: David Airlie
  Cc: Christoph Lameter, kernel-janitors, Julia Lawall, Ben Skeggs,
	Tejun Heo, dri-devel

In the original code there was a typo and we called kfree(pgraph->ctxprog)
two times instead of kfree(pgraph->ctxvals);

Also it's OK to pass NULL variables to kfree().  checkpatch.pl complains 
about this so I removed the checks.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/gpu/drm/nouveau/nouveau_grctx.c b/drivers/gpu/drm/nouveau/nouveau_grctx.c
index 32f0e49..06642a5 100644
--- a/drivers/gpu/drm/nouveau/nouveau_grctx.c
+++ b/drivers/gpu/drm/nouveau/nouveau_grctx.c
@@ -134,15 +134,11 @@ nouveau_grctx_fini(struct drm_device *dev)
 	struct drm_nouveau_private *dev_priv = dev->dev_private;
 	struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
 
-	if (pgraph->ctxprog) {
-		kfree(pgraph->ctxprog);
-		pgraph->ctxprog = NULL;
-	}
+	kfree(pgraph->ctxprog);
+	pgraph->ctxprog = NULL;
 
-	if (pgraph->ctxvals) {
-		kfree(pgraph->ctxprog);
-		pgraph->ctxvals = NULL;
-	}
+	kfree(pgraph->ctxvals);
+	pgraph->ctxvals = NULL;
 }
 
 void

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

* [patch] nouveau: fix memory leak
@ 2010-04-07  9:33 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2010-04-07  9:33 UTC (permalink / raw)
  To: David Airlie
  Cc: Christoph Lameter, kernel-janitors, Julia Lawall, Ben Skeggs,
	Tejun Heo, dri-devel

In the original code there was a typo and we called kfree(pgraph->ctxprog)
two times instead of kfree(pgraph->ctxvals);

Also it's OK to pass NULL variables to kfree().  checkpatch.pl complains 
about this so I removed the checks.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/gpu/drm/nouveau/nouveau_grctx.c b/drivers/gpu/drm/nouveau/nouveau_grctx.c
index 32f0e49..06642a5 100644
--- a/drivers/gpu/drm/nouveau/nouveau_grctx.c
+++ b/drivers/gpu/drm/nouveau/nouveau_grctx.c
@@ -134,15 +134,11 @@ nouveau_grctx_fini(struct drm_device *dev)
 	struct drm_nouveau_private *dev_priv = dev->dev_private;
 	struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
 
-	if (pgraph->ctxprog) {
-		kfree(pgraph->ctxprog);
-		pgraph->ctxprog = NULL;
-	}
+	kfree(pgraph->ctxprog);
+	pgraph->ctxprog = NULL;
 
-	if (pgraph->ctxvals) {
-		kfree(pgraph->ctxprog);
-		pgraph->ctxvals = NULL;
-	}
+	kfree(pgraph->ctxvals);
+	pgraph->ctxvals = NULL;
 }
 
 void

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--

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

end of thread, other threads:[~2010-04-07  9:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-07  9:33 [patch] nouveau: fix memory leak Dan Carpenter
2010-04-07  9:33 ` Dan Carpenter

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.