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

index 29ce45f6502026bbb35a50337fca707251e26077..e431fd07e06c09817c0a912306c93ae078baedad 100644 (file)
@@ -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;