[alsa-devel] [PATCH] Memory leak in namehint.c
John Lindgren
john.lindgren at tds.net
Tue Jul 20 21:26:32 CEST 2010
get_card_name() can be called more than once on the same list, so it
must free the previous list->cardname before replacing it.
Signed-off-by: John Lindgren <john.lindgren at tds.net>
---
src/control/namehint.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/control/namehint.c b/src/control/namehint.c
index 78572d8..fc1cb27 100644
--- a/src/control/namehint.c
+++ b/src/control/namehint.c
@@ -471,6 +471,8 @@ static int get_card_name(struct hint_list *list, int card)
char scard[16], *s;
int err;
+ if (list->cardname)
+ free(list->cardname);
err = snd_card_get_name(card, &list->cardname);
if (err <= 0)
return 0;
More information about the Alsa-devel
mailing list