summaryrefslogtreecommitdiffstats
path: root/hcid/adapter.c
diff options
context:
space:
mode:
authorCidorvan Leite <cidorvan.leite@openbossa.org>2008-03-13 22:18:33 +0000
committerCidorvan Leite <cidorvan.leite@openbossa.org>2008-03-13 22:18:33 +0000
commitcd78bb42ed0538e99b45bfbd2153a581595119ec (patch)
treeb957a7f6275113cfabc9dce8b1075066621ca269 /hcid/adapter.c
parentff296428a08dee619db1cc702146faefa91087fa (diff)
Fixed memory leak when removing uuid duplicated
Diffstat (limited to 'hcid/adapter.c')
-rw-r--r--hcid/adapter.c10
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);
}