[ALSA] fix some memory leaks
Modules: Generic drivers,ES18xx driver,CS46xx driver
This patch fixes two memory leaks spotted by the Coverity checker.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c
index 13b46d1..1a7fbef 100644
--- a/sound/drivers/serial-u16550.c
+++ b/sound/drivers/serial-u16550.c
@@ -789,6 +789,7 @@
if ((err = snd_uart16550_detect(uart)) <= 0) {
printk(KERN_ERR "no UART detected at 0x%lx\n", iobase);
+ snd_uart16550_free(uart);
return -ENODEV;
}
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index bb70926..721955d 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -2083,6 +2083,7 @@
err = pnp_activate_dev(acard->devc);
if (err < 0) {
snd_printk(KERN_ERR PFX "PnP control configure failure (out of resources?)\n");
+ kfree(cfg);
return -EAGAIN;
}
snd_printdd("pnp: port=0x%lx\n", pnp_port_start(acard->devc, 0));
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c
index 8726a68..f407d2a 100644
--- a/sound/pci/cs46xx/dsp_spos.c
+++ b/sound/pci/cs46xx/dsp_spos.c
@@ -237,7 +237,7 @@
if (ins->symbol_table.symbols == NULL) {
cs46xx_dsp_spos_destroy(chip);
- return NULL;
+ goto error;
}
ins->code.offset = 0;
@@ -246,7 +246,7 @@
if (ins->code.data == NULL) {
cs46xx_dsp_spos_destroy(chip);
- return NULL;
+ goto error;
}
ins->nscb = 0;
@@ -257,7 +257,7 @@
if (ins->modules == NULL) {
cs46xx_dsp_spos_destroy(chip);
- return NULL;
+ goto error;
}
/* default SPDIF input sample rate
@@ -280,6 +280,10 @@
/* left and right validity bits */ (1 << 13) | (1 << 12);
return ins;
+
+error:
+ kfree(ins);
+ return NULL;
}
void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip)