summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2008-03-10 20:48:10 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2008-03-10 20:48:10 +0000
commitb0566c457e956e03ae5ff3fe4ae15a9176b0ae24 (patch)
tree7b97763dcc14b8ee7aa58d5b3e043fb2ec6dbf0c /common
parent7addabc5e7dab0b368d1c947b11fa56d30893575 (diff)
bt_list2string: fixed memory leak
Diffstat (limited to 'common')
-rw-r--r--common/glib-helper.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/common/glib-helper.c b/common/glib-helper.c
index bed506c3..cb8f35c4 100644
--- a/common/glib-helper.c
+++ b/common/glib-helper.c
@@ -261,7 +261,7 @@ char *bt_uuid2string(uuid_t *uuid)
gchar *bt_list2string(GSList *list)
{
GSList *l;
- gchar *str = NULL;
+ gchar *str, *tmp;
if (!list)
return NULL;
@@ -269,8 +269,11 @@ gchar *bt_list2string(GSList *list)
str = g_strdup((const gchar *) list->data);
/* FIXME: eglib doesn't support g_strconcat */
- for (l = list->next; l; l = l->next)
- str = g_strconcat(str, " " , (const gchar *) l->data, NULL);
+ for (l = list->next; l; l = l->next) {
+ tmp = g_strconcat(str, " " , (const gchar *) l->data, NULL);
+ g_free(str);
+ str = tmp;
+ }
return str;
}