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

index 94c83a7f446c674c8ee4562a262d567d760a0a6b..eb4ca981c5f186c2d0f39574c79755f644169d34 100644 (file)
@@ -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;
        }