mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-06 13:29:59 -05:00
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:
parent
2a94d80407
commit
8dde984237
1 changed files with 2 additions and 0 deletions
|
|
@ -471,6 +471,8 @@ static int get_card_name(struct hint_list *list, int card)
|
||||||
char scard[16], *s;
|
char scard[16], *s;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
free(list->cardname);
|
||||||
|
list->cardname = NULL;
|
||||||
err = snd_card_get_name(card, &list->cardname);
|
err = snd_card_get_name(card, &list->cardname);
|
||||||
if (err <= 0)
|
if (err <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue