From: Deokhyun Kim Date: Tue, 7 Nov 2017 09:52:16 +0000 (+0900) Subject: Fix mem leak. X-Git-Tag: accepted/tizen/unified/20171207.070143~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F22%2F162522%2F1;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git Fix mem leak. Change-Id: Iaa6f68f1e773ea543d45d9b3695e569552e0399a Signed-off-by: Deokhyun Kim Signed-off-by: DoHyun Pyun --- diff --git a/bt-api/bt-hid-device.c b/bt-api/bt-hid-device.c index 93cd4fd..b287ca7 100644 --- a/bt-api/bt-hid-device.c +++ b/bt-api/bt-hid-device.c @@ -238,19 +238,17 @@ static gboolean __hid_disconnect(hid_connected_device_info_t *info) } info->disconnect_idle_id = 0; event_info = _bt_event_get_cb_data(BT_HID_DEVICE_EVENT); - if (event_info == NULL) - return FALSE; + if (event_info != NULL) { + memset(&bd_addr, 0x00, sizeof(bluetooth_device_address_t)); + _bt_convert_addr_string_to_type(bd_addr.addr , info->address); + _bt_common_event_cb(BLUETOOTH_HID_DEVICE_DISCONNECTED, + BLUETOOTH_ERROR_NONE, &bd_addr, + event_info->cb, event_info->user_data); + } - memset(&bd_addr, 0x00, sizeof(bluetooth_device_address_t)); - _bt_convert_addr_string_to_type(bd_addr.addr , info->address); - _bt_common_event_cb(BLUETOOTH_HID_DEVICE_DISCONNECTED, - BLUETOOTH_ERROR_NONE, &bd_addr, - event_info->cb, event_info->user_data); - if (info->address) - g_free(info->address); + g_free(info->address); g_free(info); - info = NULL; - BT_DBG("-"); + return FALSE; }