From: DoHyun Pyun Date: Thu, 12 Oct 2017 05:45:14 +0000 (+0900) Subject: Fix the crash issue in OTP manual testcase X-Git-Tag: submit/tizen_4.0/20171016.011411^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0f574b1a6ffc49bccaf15ad234f776055ced9fbf;p=platform%2Fcore%2Fapi%2Fbluetooth.git Fix the crash issue in OTP manual testcase Change-Id: I767113f01ede106b6a99b8ab85a97acc3f9721bb Signed-off-by: DoHyun Pyun --- diff --git a/src/bluetooth-otp.c b/src/bluetooth-otp.c index 2dcf1b9..688f94e 100644 --- a/src/bluetooth-otp.c +++ b/src/bluetooth-otp.c @@ -2044,12 +2044,18 @@ void _bt_otc_connection_state_changed(int result, bluetooth_otc_info_t *otc_info if (otp_client_s->curr_op == BT_OTP_OBJECT_WRITE) { _bt_otp_client_write_on_fd(otc_info); } else if (otp_client_s->curr_op == BT_OTP_OBJECT_READ) { + bluetooth_otc_info_t *new_otc_info = g_malloc0(sizeof(bluetooth_otc_info_t)); + + new_otc_info->fd = otc_info->fd; + new_otc_info->connected = otc_info->connected; + new_otc_info->address = g_strdup(otc_info->address); + id = g_io_add_watch(data_io, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL, - __client_data_received_cb, (gpointer)otc_info); + __client_data_received_cb, (gpointer)new_otc_info); timeout_id = g_timeout_add(BT_OTC_CONNECTION_MAX_TIMEOUT, - (GSourceFunc)__bt_otc_connection_timeout_cb, (gpointer)otc_info); + (GSourceFunc)__bt_otc_connection_timeout_cb, (gpointer)new_otc_info); } } else { BT_DBG("OTC Disconnected");