[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200711070835.4855-1-navid.emamdoost@gmail.com>
Date: Sat, 11 Jul 2020 02:08:30 -0500
From: Navid Emamdoost <navid.emamdoost@...il.com>
To: Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
Navid Emamdoost <navid.emamdoost@...il.com>,
alsa-devel@...a-project.org, linux-kernel@...r.kernel.org
Cc: emamd001@....edu, kjlu@....edu, smccaman@....edu
Subject: [PATCH] ALSA: trident: Fix a memory leak in snd_trident_create
In the implementation of snd_trident_create(), the allocated trident is
leaked if snd_trident_mixer() fails. Release via snd_trident_free().
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Navid Emamdoost <navid.emamdoost@...il.com>
---
sound/pci/trident/trident_main.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 6e50376163a2..e98c692f6aa9 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -3582,8 +3582,11 @@ int snd_trident_create(struct snd_card *card,
return err;
}
- if ((err = snd_trident_mixer(trident, pcm_spdif_device)) < 0)
+ err = snd_trident_mixer(trident, pcm_spdif_device);
+ if (err < 0) {
+ snd_trident_free(trident);
return err;
+ }
/* initialise synth voices */
for (i = 0; i < 64; i++) {
--
2.17.1
Powered by blists - more mailing lists