From cd78bb42ed0538e99b45bfbd2153a581595119ec Mon Sep 17 00:00:00 2001 From: Cidorvan Leite Date: Thu, 13 Mar 2008 22:18:33 +0000 Subject: Fixed memory leak when removing uuid duplicated --- hcid/adapter.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'hcid/adapter.c') 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); } -- cgit