[PATCH] [UBUNTU:sound/pcmcia/pdaudiocf/] Fix Coverity #1099 (memory leak in sound/pcmcia/pdaudiocf/pdaudiocf.c)

crimsun at fungus.sh.nu crimsun at fungus.sh.nu
Fri Apr 14 00:18:45 UTC 2006


Subject: [PATCH] [UBUNTU:sound/pcmcia/pdaudiocf/] Fix Coverity #1099 (memory leak in sound/pcmcia/pdaudiocf/pdaudiocf.c)

UpstreamStatus: Added in http://www.kernel.org/git/?p=linux/kernel/git/perex/alsa-current.git;a=commit;h=c2c962969e12be6061c8ee899782434e256dccb2

This patch from Eric Sesterhenn <snakebyte at gmx.de> fixes Coverity #1099
(memory leak). Patch tweaked to apply to our kernel source.

Signed-off-by: Daniel T Chen <crimsun at ubuntu.com>

---

 sound/pcmcia/pdaudiocf/pdaudiocf.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

a2f283a0117deee356255327c78de0ae3002820d
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c
index d6918b4..98a8d67 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c
@@ -285,7 +285,6 @@ static void pdacf_config(dev_link_t *lin
 	CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, parse));
 	link->conf.ConfigBase = parse->config.base;
 	link->conf.ConfigIndex = 0x5;
-	kfree(parse);
 
 	CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &conf));
 	link->conf.Vcc = conf.Vcc;
@@ -297,6 +296,8 @@ static void pdacf_config(dev_link_t *lin
 	CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
 	CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
 
+	kfree(parse);
+
 	if (snd_pdacf_assign_resources(pdacf, link->io.BasePort1, link->irq.AssignedIRQ) < 0)
 		goto failed;
 
@@ -305,6 +306,7 @@ static void pdacf_config(dev_link_t *lin
 	return;
 
 cs_failed:
+	kfree(parse);
 	cs_error(link->handle, last_fn, last_ret);
 failed:
 	pcmcia_release_configuration(link->handle);
-- 
1.1.3


-- 
Daniel T. Chen            crimsun at ubuntu.com
GPG key:   www.sh.nu/~crimsun/pubkey.gpg.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20060413/166300de/attachment.sig>


More information about the kernel-team mailing list