Skip to content

Commit

Permalink
[PATCH] Fix memory leak in isapnp
Browse files Browse the repository at this point in the history
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 <jesper.juhl@gmail.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Jesper Juhl authored and Linus Torvalds committed Mar 25, 2006
1 parent bda44e1 commit 656bde5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/pnp/isapnp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 656bde5

Please sign in to comment.