[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191027192415.32743-1-navid.emamdoost@gmail.com>
Date: Sun, 27 Oct 2019 14:24:13 -0500
From: Navid Emamdoost <navid.emamdoost@...il.com>
To: unlisted-recipients:; (no To-header on input)
Cc: emamd001@....edu, kjlu@....edu, smccaman@....edu,
Navid Emamdoost <navid.emamdoost@...il.com>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Thomas Gleixner <tglx@...utronix.de>,
Allison Randal <allison@...utok.net>,
Tim Blechmann <tim@...ngt.org>,
Hariprasad Kelam <hariprasad.kelam@...il.com>,
alsa-devel@...a-project.org, linux-kernel@...r.kernel.org
Subject: [PATCH] ALSA: lx6464es: Fix memory leaks in snd_lx6464es_create
In the implementation of snd_lx6464es_create() it there are memory leaks
when error happens. Go to error path if any of these calls fail:
lx_init_dsp(), lx_pcm_create(), lx_proc_create(), snd_ctl_add().
Fixes: 02bec4904508 ("ALSA: lx6464es - driver for the digigram lx6464es interface")
Signed-off-by: Navid Emamdoost <navid.emamdoost@...il.com>
---
sound/pci/lx6464es/lx6464es.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c
index fe10714380f2..7c6e8f4ef826 100644
--- a/sound/pci/lx6464es/lx6464es.c
+++ b/sound/pci/lx6464es/lx6464es.c
@@ -1020,25 +1020,26 @@ static int snd_lx6464es_create(struct snd_card *card,
err = lx_init_dsp(chip);
if (err < 0) {
dev_err(card->dev, "error during DSP initialization\n");
- return err;
+ goto cleanup;
}
err = lx_pcm_create(chip);
if (err < 0)
- return err;
+ goto cleanup;
err = lx_proc_create(card, chip);
if (err < 0)
- return err;
+ goto cleanup;
err = snd_ctl_add(card, snd_ctl_new1(&lx_control_playback_switch,
chip));
if (err < 0)
- return err;
+ goto cleanup;
*rchip = chip;
return 0;
+cleanup:
device_new_failed:
free_irq(pci->irq, chip);
--
2.17.1
Powered by blists - more mailing lists