aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2010-10-20 18:55:45 -0400
committerKyle McMartin <kyle@mcmartin.ca>2010-10-21 21:03:47 -0400
commit338e4fab3d41aa14264e10ce505a7c908633cdad (patch)
tree66f754dfe6995eb9456c685143aa0ffc65b1735d /drivers/char/agp
parent7da1272547ebe96982a42292dfc833457708f4da (diff)
drivers/char/agp/parisc-agp.c: eliminate memory leak
alloc_pci_dev allocates some memory, so that memory should be freed before leaving the function in an error case. 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 = alloc_pci_dev(...); <... 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> Dan Carpenter <error27@gmail.com> Dave Airlie <airlied@linux.ie> Cc: Helge Deller <deller@gmx.de> Cc: "James E.J. Bottomley" <jejb@parisc-linux.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Kyle McMartin <kyle@redhat.com>
Diffstat (limited to 'drivers/char/agp')
-rw-r--r--drivers/char/agp/parisc-agp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c
index 1c129211302..17e380f5f81 100644
--- a/drivers/char/agp/parisc-agp.c
+++ b/drivers/char/agp/parisc-agp.c
@@ -358,8 +358,12 @@ parisc_agp_setup(void __iomem *ioc_hpa, void __iomem *lba_hpa)
358 bridge->dev = fake_bridge_dev; 358 bridge->dev = fake_bridge_dev;
359 359
360 error = agp_add_bridge(bridge); 360 error = agp_add_bridge(bridge);
361 if (error)
362 goto fail;
363 return 0;
361 364
362fail: 365fail:
366 kfree(fake_bridge_dev);
363 return error; 367 return error;
364} 368}
365 369