From: Navid Emamdoost <navid.emamdoost@gmail.com>
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Navid Emamdoost <navid.emamdoost@gmail.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Cc: emamd001@umn.edu, kjlu@umn.edu, smccaman@umn.edu
Subject: [PATCH] ALSA: trident: Fix a memory leak in snd_trident_create
Date: Sat, 11 Jul 2020 02:08:30 -0500 [thread overview]
Message-ID: <20200711070835.4855-1-navid.emamdoost@gmail.com> (raw)
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@gmail.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
next reply other threads:[~2020-07-11 7:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-11 7:08 Navid Emamdoost [this message]
2020-07-11 9:04 ` Takashi Iwai
2020-07-11 18:16 ` Navid Emamdoost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200711070835.4855-1-navid.emamdoost@gmail.com \
--to=navid.emamdoost@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=emamd001@umn.edu \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=smccaman@umn.edu \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®