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

index dadbb5bc803218c0f0a8d3c9e46608e0f498f6aa..8ab4fb01d37bedcdf7dc899e1e566c0548cd0172 100644 (file)
@@ -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;