From: Jesper Juhl Date: Sun, 3 Jul 2011 23:46:53 +0000 (+1000) Subject: drm/nouveau: do not leak in nv20_graph_create X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=1541fa854273abee954ec4ca4ad65fe4ceb9e626;p=~shefty%2Frdma-dev.git drm/nouveau: do not leak in nv20_graph_create If we return due to an unknown chipset in drivers/gpu/drm/nouveau/nv20_graph.c:nv20_graph_create() we'll leak the memory allocated to 'pgraph'. This patch should fix the leak. Signed-off-by: Jesper Juhl Reviewed-by: Marcin Slusarz Signed-off-by: Ben Skeggs --- diff --git a/drivers/gpu/drm/nouveau/nv20_graph.c b/drivers/gpu/drm/nouveau/nv20_graph.c index affc7d7dd02..f8736270f62 100644 --- a/drivers/gpu/drm/nouveau/nv20_graph.c +++ b/drivers/gpu/drm/nouveau/nv20_graph.c @@ -753,6 +753,7 @@ nv20_graph_create(struct drm_device *dev) break; default: NV_ERROR(dev, "PGRAPH: unknown chipset\n"); + kfree(pgraph); return 0; } } else { @@ -774,6 +775,7 @@ nv20_graph_create(struct drm_device *dev) break; default: NV_ERROR(dev, "PGRAPH: unknown chipset\n"); + kfree(pgraph); return 0; } }