[PATCH - Multiple plugins 2/4] jack: Fix leaks when jack_set_hw_constraint() fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If jack_set_hw_constraint() returns error, we leak the 'jack' object and
all the resources referenced by it. This patch fixes the issue by
calling snd_pcm_jack_free() before returning.

Signed-off-by: Andre Guedes <andre.guedes@xxxxxxxxx>
---
 jack/pcm_jack.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/jack/pcm_jack.c b/jack/pcm_jack.c
index b39835e..6aaecac 100644
--- a/jack/pcm_jack.c
+++ b/jack/pcm_jack.c
@@ -538,6 +538,7 @@ static int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
 	err = jack_set_hw_constraint(jack);
 	if (err < 0) {
 		snd_pcm_ioplug_delete(&jack->io);
+		snd_pcm_jack_free(jack);
 		return err;
 	}
 
-- 
2.14.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux