[alsa-devel] [PATCH - Multiple plugins 1/4] a52: Fix leaks when a52_set_hw_constraint() fails

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


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 at intel.com>
---
 a52/pcm_a52.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/a52/pcm_a52.c b/a52/pcm_a52.c
index 29ce45f..e431fd0 100644
--- a/a52/pcm_a52.c
+++ b/a52/pcm_a52.c
@@ -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;
-- 
2.14.4



More information about the Alsa-devel mailing list