From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Wed, 07 Apr 2010 09:33:36 +0000 Subject: [patch] nouveau: fix memory leak Message-Id: <20100407093336.GE5157@bicker> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: David Airlie Cc: Christoph Lameter , kernel-janitors@vger.kernel.org, Julia Lawall , Ben Skeggs , Tejun Heo , dri-devel@lists.sourceforge.net 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 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: [patch] nouveau: fix memory leak Date: Wed, 7 Apr 2010 12:33:36 +0300 Message-ID: <20100407093336.GE5157@bicker> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.sourceforge.net To: David Airlie Cc: Christoph Lameter , kernel-janitors@vger.kernel.org, Julia Lawall , Ben Skeggs , Tejun Heo , dri-devel@lists.sourceforge.net List-Id: dri-devel@lists.freedesktop.org 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 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® 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 --