From: Andre Guedes <andre.guedes@intel.com>
To: alsa-devel@alsa-project.org
Subject: [PATCH - Multiple plugins 4/4] usb_stream: Fix leaks when us_set_hw_constraint() fails
Date: Fri, 28 Sep 2018 14:27:27 -0700 [thread overview]
Message-ID: <20180928212727.15151-5-andre.guedes@intel.com> (raw)
In-Reply-To: <20180928212727.15151-1-andre.guedes@intel.com>
If us_set_hw_constraint() returns error, we leak the 'us' object and all
the resources referenced by it. This patch fixes the issue by calling
us_free() before returning.
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
---
usb_stream/pcm_usb_stream.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/usb_stream/pcm_usb_stream.c b/usb_stream/pcm_usb_stream.c
index 94c83a7..eb4ca98 100644
--- a/usb_stream/pcm_usb_stream.c
+++ b/usb_stream/pcm_usb_stream.c
@@ -455,6 +455,7 @@ static int snd_pcm_us_open(snd_pcm_t **pcmp, const char *name,
err = us_set_hw_constraint(us);
if (err < 0) {
snd_pcm_ioplug_delete(&us->io);
+ us_free(us);
return err;
}
--
2.14.4
next prev parent reply other threads:[~2018-09-28 21:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-28 21:27 [PATCH - Multiple plugins 0/4] Fix leaks on multiple plugins Andre Guedes
2018-09-28 21:27 ` [PATCH - Multiple plugins 1/4] a52: Fix leaks when a52_set_hw_constraint() fails Andre Guedes
2018-09-28 21:27 ` [PATCH - Multiple plugins 2/4] jack: Fix leaks when jack_set_hw_constraint() fails Andre Guedes
2018-09-28 21:27 ` [PATCH - Multiple plugins 3/4] oss: Fix leaks when oss_hw_constraint() fails Andre Guedes
2018-09-28 21:27 ` Andre Guedes [this message]
2018-10-02 9:18 ` [PATCH - Multiple plugins 0/4] Fix leaks on multiple plugins Takashi Sakamoto
2018-10-02 15:56 ` Takashi Iwai
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=20180928212727.15151-5-andre.guedes@intel.com \
--to=andre.guedes@intel.com \
--cc=alsa-devel@alsa-project.org \
/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