From 1df4908a246ce1370660aa90a65b8de35097318c Mon Sep 17 00:00:00 2001 From: Ivica Ico Bukvic <ico@vt.edu> Date: Mon, 15 Sep 2014 13:55:22 -0400 Subject: [PATCH] *properly fixed invalid pointer access in the s_audio_alsa.c --- pd/src/s_audio_alsa.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pd/src/s_audio_alsa.c b/pd/src/s_audio_alsa.c index 88dc9b74c..91fc385fe 100644 --- a/pd/src/s_audio_alsa.c +++ b/pd/src/s_audio_alsa.c @@ -839,7 +839,7 @@ void alsa_getdevs(char *indevlist, int *nindevs, while (!snd_card_next(&cardno) && cardno >= 0) { snd_ctl_t *ctl; - snd_ctl_card_info_t *info; + snd_ctl_card_info_t *info = NULL; char devname[80]; const char *desc; if (2 * ndev + 2 > maxndev) @@ -854,7 +854,6 @@ void alsa_getdevs(char *indevlist, int *nindevs, snd_ctl_card_info_malloc(&info); snd_ctl_card_info(ctl, info); desc = snd_ctl_card_info_get_name(info); - //snd_ctl_card_info_free(info); } else { @@ -867,6 +866,11 @@ void alsa_getdevs(char *indevlist, int *nindevs, sprintf(outdevlist + 2*ndev * devdescsize, "%s (hardware)", desc); sprintf(outdevlist + (2*ndev + 1) * devdescsize, "%s (plug-in)", desc); ndev++; + if (info) + { + snd_ctl_card_info_free(info); + info = NULL; + } } for (i = 0, j = 2*ndev; i < alsa_nnames; i++, j++) { -- GitLab