projects/linux·commit 656bde57

[PATCH] Fix memory leak in isapnp

656bde57 · Jesper Juhl <[email protected]> · 2006-03-25 03:08:12 -08:00

Spotted by the Coverity checker as bug #666

akpm; there are several other `return 1;'s in there which aren't freeing
`dev'.  (A fix which converts this function to single-exit would be
preferred..)

Signed-off-by: Jesper Juhl <[email protected]>
Cc: Adam Belay <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Commit
656bde5728b824ca23fcab8bc5800b309ea48d64
Parents
bda44e1d

Changes

1 files changed · +3 −1

FileStatusAddDelContent
drivers/pnp/isapnp/core.cmodified+3−1View file

drivers/pnp/isapnp/core.c

View file
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index 57fd603..b1b4b68 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -646,8 +646,10 @@ static int __init isapnp_create_device(struct pnp_card *card,
size = 0;
skip = 0;
option = pnp_register_independent_option(dev);
- if (!option)
+ if (!option) {
+ kfree(dev);
return 1;
+ }
pnp_add_card_device(card,dev);
} else {
skip = 1;