[PATCH] drm, ast_fb: Fix a small leak in astfb_create()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We have this code:

...
	sysram = vmalloc(size);
	if (!sysram)
		return -ENOMEM;

	info = framebuffer_alloc(0, device);
	if (!info) {
		ret = -ENOMEM;
		goto out;
	}
...

We'll leak the memory allocated to 'sysram' if the framebuffer_alloc()
call fails and the variable goes out of scope.

Signed-off-by: Jesper Juhl <jj@xxxxxxxxxxxxx>
---
 drivers/gpu/drm/ast/ast_fb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
index 2fc8e9e..260a760 100644
--- a/drivers/gpu/drm/ast/ast_fb.c
+++ b/drivers/gpu/drm/ast/ast_fb.c
@@ -180,6 +180,7 @@ static int astfb_create(struct ast_fbdev *afbdev,
 
 	info = framebuffer_alloc(0, device);
 	if (!info) {
+		vfree(sysram);
 		ret = -ENOMEM;
 		goto out;
 	}
-- 
1.7.11.2


-- 
Jesper Juhl <jj@xxxxxxxxxxxxx>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux