From: Deokhyun Kim Date: Thu, 22 Jun 2017 07:11:58 +0000 (+0900) Subject: Fix the SVace issue. X-Git-Tag: submit/tizen_3.0/20170716.235230~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F97%2F135397%2F1;p=platform%2Fcore%2Fapi%2Fbluetooth.git Fix the SVace issue. Change-Id: I49db49f4cc0ae6dd0a30217f66bd4e36c0ee8c4d Signed-off-by: Deokhyun Kim --- diff --git a/src/bluetooth-tds.c b/src/bluetooth-tds.c index 5459e80..ab3c275 100644 --- a/src/bluetooth-tds.c +++ b/src/bluetooth-tds.c @@ -648,6 +648,11 @@ int _bt_tds_parse_transport_blocks(bt_tds_transport_block_list_s **info, static void __bt_tds_reset_seeker_data(bt_tds_seeker_s *seeker) { + if ((seeker)->remote_address) { + g_free((seeker)->remote_address); + (seeker)->remote_address = NULL; + } + if ((seeker)->tds_control_point) { g_free((seeker)->tds_control_point); (seeker)->tds_control_point = NULL; @@ -1083,11 +1088,13 @@ int bt_tds_seeker_create(const char *remote_address, bt_tds_seeker_h *seeker) if (seeker_s->connected == true) { error_code = __bt_update_tds_transport_data(&addr_hex, seeker_s); if (error_code != BLUETOOTH_ERROR_NONE) { + __bt_tds_reset_seeker_data(seeker_s); g_free(seeker_s); return BT_ERROR_OPERATION_FAILED; } error_code = bluetooth_gatt_set_service_change_watcher(&addr_hex, true); if (error_code != BLUETOOTH_ERROR_NONE) { + __bt_tds_reset_seeker_data(seeker_s); g_free(seeker_s); return BT_ERROR_OPERATION_FAILED; } @@ -1095,6 +1102,7 @@ int bt_tds_seeker_create(const char *remote_address, bt_tds_seeker_h *seeker) seeker_s->remote_address = g_strdup(remote_address); if (seeker_s->remote_address == NULL) { + __bt_tds_reset_seeker_data(seeker_s); free(seeker_s); error_code = BT_ERROR_OUT_OF_MEMORY; BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);