From 9c4b9ae7f88a280c709c77e96d9415cd2fa708b3 Mon Sep 17 00:00:00 2001 From: DoHyun Pyun Date: Fri, 19 Jun 2020 09:52:50 +0900 Subject: [PATCH] Fix the svace issue - DEREF_AFTER_NULL Change-Id: Iccfd32bcffe702cfe06cf09a253aded99e36738d Signed-off-by: DoHyun Pyun --- bt-service-adaptation/services/gatt/bt-service-gatt.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/bt-service-adaptation/services/gatt/bt-service-gatt.c b/bt-service-adaptation/services/gatt/bt-service-gatt.c index e97a990..025b760 100644 --- a/bt-service-adaptation/services/gatt/bt-service-gatt.c +++ b/bt-service-adaptation/services/gatt/bt-service-gatt.c @@ -1618,13 +1618,14 @@ static void __bt_handle_gatt_server_disconnection_state(event_gatts_conn_t *even #ifndef __INTEGRATE_GATT_INFO__ /* Remove server info from list */ server_info = _bt_find_remote_gatt_server_info(address); - if (server_info) + if (server_info) { gatt_server_info_list = g_slist_remove(gatt_server_info_list, server_info); - else - BT_INFO("Can not find conn info, already removed!"); - /* Remove all services from info list_gatt_info */ - __bt_cleanup_remote_services(server_info); + /* Remove all services from info list_gatt_info */ + __bt_cleanup_remote_services(server_info); + } else { + BT_INFO("Can not find conn info, already removed!"); + } #else /* Remove all services from info list_gatt_info */ __bt_cleanup_remote_services(client_info); @@ -3006,6 +3007,11 @@ static void __bt_cleanup_remote_services(struct gatt_server_info_t *conn_info) bt_gatt_service_info_t *svc = NULL; GSList *l; + if (!conn_info) { + BT_ERR("conn_info is NULL"); + return; + } + svc_info_list = __bt_get_service_info_list(conn_info->connection_id); if (!svc_info_list) { BT_INFO("Could not find Svc Info list for the connection ID [%d]", -- 2.7.4