From a1f4ddbc956c0623f2f440a1ff390eda1e4d73b3 Mon Sep 17 00:00:00 2001 From: DoHyun Pyun Date: Thu, 3 May 2018 08:23:51 +0900 Subject: [PATCH] Fix the prevent issue Change-Id: I8561bb15d6bce03b80efd7c99f5fb57679154eb9 Signed-off-by: DoHyun Pyun --- common/src/ui/bt-main-view.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/common/src/ui/bt-main-view.c b/common/src/ui/bt-main-view.c index af35aef..d70e9f4 100644 --- a/common/src/ui/bt-main-view.c +++ b/common/src/ui/bt-main-view.c @@ -2149,9 +2149,14 @@ bt_dev_t *_bt_main_create_searched_le_device_item(void *data) return NULL; } - if (!remote_name || strlen(remote_name) == 0) + if (!remote_name) return NULL; + if (strlen(remote_name) == 0) { + g_free(remote_name); + return NULL; + } + /* only HOG Device will be shown in searched list */ if (bt_adapter_le_get_scan_result_service_uuids( dev_info, BT_ADAPTER_LE_PACKET_ADVERTISING, &uuids, &count) == BT_ERROR_NONE) { @@ -2171,7 +2176,10 @@ bt_dev_t *_bt_main_create_searched_le_device_item(void *data) } dev = calloc(1, sizeof(bt_dev_t)); - retv_if(dev == NULL, NULL); + if (dev == NULL) { + g_free(remote_name); + return NULL; + } strncpy(dev->name, remote_name, DEVICE_NAME_MAX_LEN); -- 2.7.4