All of 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 3/4] oss: Fix leaks when oss_hw_constraint() fails
Date: Fri, 28 Sep 2018 14:27:26 -0700	[thread overview]
Message-ID: <20180928212727.15151-4-andre.guedes@intel.com> (raw)
In-Reply-To: <20180928212727.15151-1-andre.guedes@intel.com>

If oss_hw_constraint() returns error, we leak 'oss' object and all the
resources referenced by it. 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>
---
 oss/pcm_oss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/oss/pcm_oss.c b/oss/pcm_oss.c
index dadbb5b..8ab4fb0 100644
--- a/oss/pcm_oss.c
+++ b/oss/pcm_oss.c
@@ -413,7 +413,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(oss)
 
 	if ((err = oss_hw_constraint(oss)) < 0) {
 		snd_pcm_ioplug_delete(&oss->io);
-		return err;
+		goto error;
 	}
 
 	*pcmp = oss->io.pcm;
-- 
2.14.4

  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 ` Andre Guedes [this message]
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-4-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.