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

If jack_set_hw_constraint() returns error, we leak the 'jack' object and
all the resources referenced by it. This patch fixes the issue by
calling snd_pcm_jack_free() before returning.

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

diff --git a/jack/pcm_jack.c b/jack/pcm_jack.c
index b39835e..6aaecac 100644
--- a/jack/pcm_jack.c
+++ b/jack/pcm_jack.c
@@ -538,6 +538,7 @@ static int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
 	err = jack_set_hw_constraint(jack);
 	if (err < 0) {
 		snd_pcm_ioplug_delete(&jack->io);
+		snd_pcm_jack_free(jack);
 		return err;
 	}
 
-- 
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 ` Andre Guedes [this message]
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-3-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.