aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/gbefb.c
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2010-10-27 18:33:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-27 21:03:08 -0400
commitf35691062a138484b51bf53b36ae8a4495d8fb91 (patch)
treeafa11d85cb32adaa425bb8e6f5ad60bf83c3fdc7 /drivers/video/gbefb.c
parentf11b478d461b7113eb4603b3914aaf15b7788e87 (diff)
drivers/video/gbefb.c: eliminate memory leak
This code is preceded by a call to framebuffer_alloc, which allocates memory, so this memory should be freed before leaving the function in an error case. out_release_framebuffer just frees the frame buffer and returns. A simplified version of the semantic match that finds this problem is: (http://coccinelle.lip6.fr/) // <smpl> @r exists@ local idexpression x; expression E; identifier f1; iterator I; @@ x = framebuffer_alloc(...); <... when != x when != true (x == NULL || ...) when != if (...) { <+...x...+> } when != I (...) { <+...x...+> } ( x == NULL | x == E | x->f1 ) ...> * return ...; // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Arnaud Patard <arnaud.patard@rtp-net.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/gbefb.c')
-rw-r--r--drivers/video/gbefb.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c
index ca3355e430bf..933899dca33a 100644
--- a/drivers/video/gbefb.c
+++ b/drivers/video/gbefb.c
@@ -1143,8 +1143,10 @@ static int __devinit gbefb_probe(struct platform_device *p_dev)
1143 return -ENOMEM; 1143 return -ENOMEM;
1144 1144
1145#ifndef MODULE 1145#ifndef MODULE
1146 if (fb_get_options("gbefb", &options)) 1146 if (fb_get_options("gbefb", &options)) {
1147 return -ENODEV; 1147 ret = -ENODEV;
1148 goto out_release_framebuffer;
1149 }
1148 gbefb_setup(options); 1150 gbefb_setup(options);
1149#endif 1151#endif
1150 1152