From: Andre Guedes Date: Fri, 28 Sep 2018 21:27:26 +0000 (-0700) Subject: oss: Fix leaks when oss_hw_constraint() fails X-Git-Tag: v1.1.7~3 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=b8bcd458b79146547fc6dae1645832695545da44;p=alsa-plugins.git oss: Fix leaks when oss_hw_constraint() fails 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 Reviewed-by: Takashi Sakamoto Signed-off-by: Takashi Iwai --- diff --git a/oss/pcm_oss.c b/oss/pcm_oss.c index dadbb5b..8ab4fb0 100644 --- a/oss/pcm_oss.c +++ b/oss/pcm_oss.c @@ -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;