Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Guedes <andre.guedes@intel.com>
To: alsa-devel@alsa-project.org
Subject: [PATCH - Multiple plugins 1/4] a52: Fix leaks when a52_set_hw_constraint() fails
Date: Fri, 28 Sep 2018 14:27:24 -0700	[thread overview]
Message-ID: <20180928212727.15151-2-andre.guedes@intel.com> (raw)
In-Reply-To: <20180928212727.15151-1-andre.guedes@intel.com>

If a52_set_hw_constraint() returns error, we leak 'rec' and
'rec->slave'. This patch fixes the issue by jumping to 'error' label
where the proper clean up is already done.

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
---
 a52/pcm_a52.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/a52/pcm_a52.c b/a52/pcm_a52.c
index 29ce45f..e431fd0 100644
--- a/a52/pcm_a52.c
+++ b/a52/pcm_a52.c
@@ -978,7 +978,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(a52)
 
 	if ((err = a52_set_hw_constraint(rec)) < 0) {
 		snd_pcm_ioplug_delete(&rec->io);
-		return err;
+		goto error;
 	}
 
 	*pcmp = rec->io.pcm;
-- 
2.14.4

  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 ` Andre Guedes [this message]
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 ` [PATCH - Multiple plugins 4/4] usb_stream: Fix leaks when us_set_hw_constraint() fails Andre Guedes
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-2-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