From: Anupam Roy Date: Tue, 24 Oct 2017 12:34:37 +0000 (+0530) Subject: GATT: Fix segmentation fault while using GATT RELAY feature X-Git-Tag: accepted/tizen/unified/20171207.070146~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8f8478e7dbdb941f7dac99fd4af54e6b227641a4;p=platform%2Fcore%2Fapi%2Fbluetooth.git GATT: Fix segmentation fault while using GATT RELAY feature bluetooth_gatt_set_descriptor_value() and bluetooth_gatt_register_service() functions are to be used only in GATT DIRECT method. These were wrongly placed inside GATT RELAY feature. Hence removed. bluetooth_gatt_register_service() method was missed in GATT DIRECT method. Change-Id: Ic8306e29069d34d429d57e5224fc5e88b1f8aba9 Signed-off-by: Anupam Roy --- diff --git a/src/bluetooth-gatt.c b/src/bluetooth-gatt.c index 4c74bed..b39ea42 100644 --- a/src/bluetooth-gatt.c +++ b/src/bluetooth-gatt.c @@ -2662,24 +2662,9 @@ int bt_gatt_server_register_service(bt_gatt_server_h server, bt_gatt_h service) goto fail; } - ret = _bt_get_error_code(bluetooth_gatt_set_descriptor_value(desc->path, - desc->value, desc->value_length)); - - if (ret != BT_ERROR_NONE) { - BT_ERR("%s(0x%08x)", - _bt_convert_error_to_string(ret), ret); - goto fail; - } } } - ret = _bt_get_error_code(bluetooth_gatt_register_service(svc->path)); - - if (ret != BT_ERROR_NONE) { - BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret); - goto fail; - } - serv->services = g_slist_append(serv->services, svc); svc->parent = (void *)server; @@ -2762,6 +2747,13 @@ int bt_gatt_server_register_service(bt_gatt_server_h server, bt_gatt_h service) } } + ret = _bt_get_error_code(bluetooth_gatt_register_service(svc->path)); + + if (ret != BT_ERROR_NONE) { + BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret); + goto fail; + } + serv->services = g_slist_append(serv->services, svc); svc->parent = (void *)server;