[PATCH 7/9] [UBUNTU:sound/pci/cs46xx] Fix memory leaks in CS46xx driver

crimsun at fungus.sh.nu crimsun at fungus.sh.nu
Tue Mar 28 08:19:16 UTC 2006


Subject: [PATCH 7/9] [UBUNTU:sound/pci/cs46xx] Fix memory leaks in CS46xx driver

UpstreamStatus: Applied, backported from http://kernel.org/git/?p=linux/kernel/git/perex/alsa-current.git;a=commitdiff;h=202728d783a0fc180e7141d18186eeae167218a1

This patch from Adrian Bunk fixes memory leaks in the CS46xx driver
spotted by the Coverity checker.

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

---

 sound/pci/cs46xx/dsp_spos.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

83ba1c0a1f4530ee1feaf704a3b13a1b371402f4
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c
index b66304f..c0826ea 100644
--- a/sound/pci/cs46xx/dsp_spos.c
+++ b/sound/pci/cs46xx/dsp_spos.c
@@ -232,7 +232,7 @@ dsp_spos_instance_t *  cs46xx_dsp_spos_c
 
 	if (ins->symbol_table.symbols == NULL) {
 		cs46xx_dsp_spos_destroy(chip);
-		return NULL;
+		goto error;
 	}
 
 	ins->code.offset = 0;
@@ -241,7 +241,7 @@ dsp_spos_instance_t *  cs46xx_dsp_spos_c
 
 	if (ins->code.data == NULL) {
 		cs46xx_dsp_spos_destroy(chip);
-		return NULL;
+		goto error;
 	}
 
 	ins->nscb = 0;
@@ -252,7 +252,7 @@ dsp_spos_instance_t *  cs46xx_dsp_spos_c
 
 	if (ins->modules == NULL) {
 		cs46xx_dsp_spos_destroy(chip);
-		return NULL;
+		goto error;
 	}
 
 	/* default SPDIF input sample rate
@@ -275,6 +275,10 @@ dsp_spos_instance_t *  cs46xx_dsp_spos_c
 	 /* left and right validity bits */ (1 << 13) | (1 << 12);
 
 	return ins;
+
+error:
+	kfree(ins);
+	return NULL;
 }
 
 void  cs46xx_dsp_spos_destroy (cs46xx_t * chip)
-- 
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/20060328/48269965/attachment.sig>


More information about the kernel-team mailing list