]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
jack: Fix leaks when jack_set_hw_constraint() fails
authorAndre Guedes <andre.guedes@intel.com>
Fri, 28 Sep 2018 21:27:25 +0000 (14:27 -0700)
committerTakashi Iwai <tiwai@suse.de>
Tue, 2 Oct 2018 15:54:30 +0000 (17:54 +0200)
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>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
jack/pcm_jack.c

index b39835e7c523258c3c46e526e4c309fdaf6f8e9e..6aaecac8361f994d9bc2443ead8fad43a0474e95 100644 (file)
@@ -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;
        }