[alsa-devel] [PATCH - Multiple plugins 3/4] oss: Fix leaks when oss_hw_constraint() fails

Andre Guedes andre.guedes at intel.com
Fri Sep 28 23:27:26 CEST 2018


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 at intel.com>
---
 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.14.4



More information about the Alsa-devel mailing list