diff options
author | Cidorvan Leite <cidorvan.leite@openbossa.org> | 2008-03-13 22:18:33 +0000 |
---|---|---|
committer | Cidorvan Leite <cidorvan.leite@openbossa.org> | 2008-03-13 22:18:33 +0000 |
commit | cd78bb42ed0538e99b45bfbd2153a581595119ec (patch) | |
tree | b957a7f6275113cfabc9dce8b1075066621ca269 /hcid | |
parent | ff296428a08dee619db1cc702146faefa91087fa (diff) |
Fixed memory leak when removing uuid duplicated
Diffstat (limited to 'hcid')
-rw-r--r-- | hcid/adapter.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/hcid/adapter.c b/hcid/adapter.c index 608355f3..d46527d0 100644 --- a/hcid/adapter.c +++ b/hcid/adapter.c @@ -3360,10 +3360,14 @@ static void discover_services_cb(gpointer user_data, sdp_list_t *recs, int err) if (sdp_get_service_classes(rec, &svcclass) == 0) { /* Extract the first element and skip the remainning */ gchar *uuid_str = bt_uuid2string(svcclass->data); - if (uuid_str && !g_slist_find_custom(uuids, uuid_str, + if (uuid_str) { + if (!g_slist_find_custom(uuids, uuid_str, (GCompareFunc) strcmp)) - uuids = g_slist_insert_sorted(uuids, uuid_str, - (GCompareFunc) strcmp); + uuids = g_slist_insert_sorted(uuids, + uuid_str, (GCompareFunc) strcmp); + else + g_free(uuid_str); + } sdp_list_free(svcclass, free); } |