All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Memory leak in namehint.c
@ 2010-07-20 19:26 John Lindgren
  2010-07-20 22:38 ` John Lindgren
  0 siblings, 1 reply; 3+ messages in thread
From: John Lindgren @ 2010-07-20 19:26 UTC (permalink / raw)
  To: alsa-devel

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>
---

 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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-21  7:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-20 19:26 [PATCH] Memory leak in namehint.c John Lindgren
2010-07-20 22:38 ` John Lindgren
2010-07-21  7:28   ` Jaroslav Kysela

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.