[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1206220012470.7671@swampdragon.chaosbits.net>
Date: Fri, 22 Jun 2012 00:13:56 +0200 (CEST)
From: Jesper Juhl <jj@...osbits.net>
To: Dave Airlie <airlied@...hat.com>
cc: David Airlie <airlied@...ux.ie>, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] mgag200: Fix a memory leak in mgag200fb_create()
First we allocate memory for 'sysram' with vmalloc() and subsequently
we allocate for 'info' with framebuffer_alloc(). If the second
allocation fails we return -ENOMEM, but neglect to vfree() the memory
we previously allocated for 'sysram', thus leaking it.
Signed-off-by: Jesper Juhl <jj@...osbits.net>
---
drivers/gpu/drm/mgag200/mgag200_fb.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c b/drivers/gpu/drm/mgag200/mgag200_fb.c
index 880d336..3c837e5 100644
--- a/drivers/gpu/drm/mgag200/mgag200_fb.c
+++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
@@ -156,8 +156,10 @@ static int mgag200fb_create(struct mga_fbdev *mfbdev,
return -ENOMEM;
info = framebuffer_alloc(0, device);
- if (info == NULL)
+ if (info == NULL) {
+ vfree(sysram);
return -ENOMEM;
+ }
info->par = mfbdev;
--
1.7.11
--
Jesper Juhl <jj@...osbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
--
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