There's a potential memory leak in
sound/pcmcia/pdaudiocf/pdaudiocf.c::pdacf_config()
If we leave via one of the *failed: labels we may leak 'parse', so add a
kfree(parse) to the end of the function and also make sure to set 'parse'
to NULL after the kfree() call a little further up so we don't do a
double-free of the pointer if we hit one of the *failed: labels after the
first kfree().
Since I don't have the hardware I can't test the patch beyond making sure
it compiles cleanly, but I feel pretty confident that it is correct.
Please consider for inclusion.
Signed-off-by: Jesper Juhl <[email protected]>
---
sound/pcmcia/pdaudiocf/pdaudiocf.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)
--- linux-2.6.17-rc4-git2-orig/sound/pcmcia/pdaudiocf/pdaudiocf.c 2006-05-13 21:28:55.000000000 +0200
+++ linux-2.6.17-rc4-git2/sound/pcmcia/pdaudiocf/pdaudiocf.c 2006-05-13 23:27:46.000000000 +0200
@@ -226,7 +226,7 @@ static int pdacf_config(struct pcmcia_de
snd_printdd(KERN_DEBUG "pdacf_config called\n");
parse = kmalloc(sizeof(*parse), GFP_KERNEL);
- if (! parse) {
+ if (!parse) {
snd_printk(KERN_ERR "pdacf_config: cannot allocate\n");
return -ENOMEM;
}
@@ -242,6 +242,7 @@ static int pdacf_config(struct pcmcia_de
link->conf.ConfigBase = parse->config.base;
link->conf.ConfigIndex = 0x5;
kfree(parse);
+ parse = NULL;
CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
@@ -257,6 +258,7 @@ cs_failed:
cs_error(link, last_fn, last_ret);
failed:
pcmcia_disable_device(link);
+ kfree(parse);
return -ENODEV;
}
PS. Please keep me on Cc when replying since I'm not subscribed to alsa-devel.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]