summaryrefslogtreecommitdiff
path: root/sound/pcmcia/pdaudiocf/pdaudiocf.c
diff options
context:
space:
mode:
authorEric Sesterhenn <snakebyte@gmx.de>2006-04-12 14:56:10 +0400
committerJaroslav Kysela <perex@suse.cz>2006-07-12 22:07:23 +0400
commitcb6dd2609779e55b34876d75a9092b1a1f513142 (patch)
treea61061cf2d4be2e55cdf04ba6378e68cff8e5a46 /sound/pcmcia/pdaudiocf/pdaudiocf.c
parentb2d6744849b5bf6b4593b81c136772df7a238ac9 (diff)
downloadlinux-cb6dd2609779e55b34876d75a9092b1a1f513142.tar.xz
[ALSA] Memory leak in sound/pcmcia/pdaudiocf/pdaudiocf.c
if one of the first three CS_CHECKS fails, we goto cs_failed: In this case parse we donr kfree() parse. Since the the last three CS_CHECKS might also fail, i moved the kfree() below all the CS_CHECKs and added one in the error path. This fixes coverity bug id #1099 Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pcmcia/pdaudiocf/pdaudiocf.c')
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c
index adfdce7499d1..1c09e5f49da8 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c
@@ -241,12 +241,13 @@ static int pdacf_config(struct pcmcia_device *link)
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
link->conf.ConfigBase = parse->config.base;
link->conf.ConfigIndex = 0x5;
- kfree(parse);
CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
+ kfree(parse);
+
if (snd_pdacf_assign_resources(pdacf, link->io.BasePort1, link->irq.AssignedIRQ) < 0)
goto failed;
@@ -254,6 +255,7 @@ static int pdacf_config(struct pcmcia_device *link)
return 0;
cs_failed:
+ kfree(parse);
cs_error(link, last_fn, last_ret);
failed:
pcmcia_disable_device(link);