Fix the svace issue - DEREF_AFTER_NULL 17/236617/1
authorDoHyun Pyun <dh79.pyun@samsung.com>
Fri, 19 Jun 2020 00:52:50 +0000 (09:52 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Fri, 19 Jun 2020 00:52:50 +0000 (09:52 +0900)
Change-Id: Iccfd32bcffe702cfe06cf09a253aded99e36738d
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-service-adaptation/services/gatt/bt-service-gatt.c

index e97a990..025b760 100644 (file)
@@ -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]",