Memory leak in namehint.c

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@tds.net>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
John Lindgren 2010-07-21 00:38:37 +02:00 committed by Jaroslav Kysela
parent 2a94d80407
commit 8dde984237

View file

@ -471,6 +471,8 @@ static int get_card_name(struct hint_list *list, int card)
char scard[16], *s;
int err;
free(list->cardname);
list->cardname = NULL;
err = snd_card_get_name(card, &list->cardname);
if (err <= 0)
return 0;