Commit cb6dd260 authored by Eric Sesterhenn's avatar Eric Sesterhenn Committed by Jaroslav Kysela

[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: default avatarEric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent b2d67448
...@@ -241,12 +241,13 @@ static int pdacf_config(struct pcmcia_device *link) ...@@ -241,12 +241,13 @@ static int pdacf_config(struct pcmcia_device *link)
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse)); CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
link->conf.ConfigBase = parse->config.base; link->conf.ConfigBase = parse->config.base;
link->conf.ConfigIndex = 0x5; link->conf.ConfigIndex = 0x5;
kfree(parse);
CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
kfree(parse);
if (snd_pdacf_assign_resources(pdacf, link->io.BasePort1, link->irq.AssignedIRQ) < 0) if (snd_pdacf_assign_resources(pdacf, link->io.BasePort1, link->irq.AssignedIRQ) < 0)
goto failed; goto failed;
...@@ -254,6 +255,7 @@ static int pdacf_config(struct pcmcia_device *link) ...@@ -254,6 +255,7 @@ static int pdacf_config(struct pcmcia_device *link)
return 0; return 0;
cs_failed: cs_failed:
kfree(parse);
cs_error(link, last_fn, last_ret); cs_error(link, last_fn, last_ret);
failed: failed:
pcmcia_disable_device(link); pcmcia_disable_device(link);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment