From 6b546af4b54d6a48fa77bfafc5a67b53293238d9 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 8 Sep 2016 14:54:43 +0300 Subject: [PATCH] scanparam: Fix not handling accept properly On accept the profile shall check about existing attribute, etc and once done call btd_service_connecting_complete updating the service state properly. --- profiles/scanparam/scan.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/profiles/scanparam/scan.c b/profiles/scanparam/scan.c index d3ca762df..d12e09e8d 100644 --- a/profiles/scanparam/scan.c +++ b/profiles/scanparam/scan.c @@ -201,7 +201,6 @@ static int scan_param_accept(struct btd_service *service) gatt_db_unref(scan->db); bt_gatt_client_unref(scan->client); - scan->db = gatt_db_ref(db); scan->client = bt_gatt_client_ref(client); @@ -209,6 +208,17 @@ static int scan_param_accept(struct btd_service *service) gatt_db_foreach_service(db, &scan_parameters_uuid, foreach_scan_param_service, scan); + if (!scan->attr) { + error("Scan Parameters attribute not found"); + gatt_db_unref(scan->db); + scan->db = NULL; + bt_gatt_client_unref(scan->client); + scan->client = NULL; + return -1; + } + + btd_service_connecting_complete(service, 0); + return 0; } -- 2.47.3