Please disregard the previous patch as it has the potential for a double free() if snd_card_get_name() fails. Here is a corrected patch. Signed-off-by: John Lindgren <john.lindgren@xxxxxxx> --- 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..1819292 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; + free(list->cardname); + list->cardname = NULL; err = snd_card_get_name(card, &list->cardname); if (err <= 0) return 0; On 07/20/2010 03:26 PM, John Lindgren wrote: > 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@xxxxxxx> > --- > > 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; > _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel