Skip to content

Commit

Permalink
[ALSA] Memory leak in sound/pcmcia/pdaudiocf/pdaudiocf.c
Browse files Browse the repository at this point in the history
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 torvalds#1099

Signed-off-by: Eric Sesterhenn <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Jaroslav Kysela <[email protected]>
  • Loading branch information
SesterhennEric authored and Jaroslav Kysela committed Jul 12, 2006
1 parent b2d6744 commit cb6dd26
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sound/pcmcia/pdaudiocf/pdaudiocf.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,19 +241,21 @@ 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;

link->dev_node = &pdacf->node;
return 0;

cs_failed:
kfree(parse);
cs_error(link, last_fn, last_ret);
failed:
pcmcia_disable_device(link);
Expand Down

0 comments on commit cb6dd26

Please sign in to comment.