From b8bcd458b79146547fc6dae1645832695545da44 Mon Sep 17 00:00:00 2001 From: Andre Guedes Date: Fri, 28 Sep 2018 14:27:26 -0700 Subject: [PATCH] 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 --- oss/pcm_oss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.47.1