Fix Dereferencing of NULL pointer error 62/276262/1
authorAnuj Jain <anuj01.jain@samsung.com>
Mon, 13 Jun 2022 13:44:06 +0000 (19:14 +0530)
committerAnuj Jain <anuj01.jain@samsung.com>
Mon, 13 Jun 2022 13:47:23 +0000 (19:17 +0530)
Change-Id: Ia3e1e098401ffe0e3ff4ec23b4bae601be570c08
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
bt-api/bt-l2cap-le-server.c

index 350ebe3..c86dfe3 100644 (file)
@@ -504,7 +504,8 @@ static gboolean __data_received_cb(GIOChannel *chan, GIOCondition cond,
        return TRUE;
 fail:
        BT_ERR("Failure occured, remove client connection");
-       server_info->conn_list = g_slist_remove(
+       if (server_info)
+               server_info->conn_list = g_slist_remove(
                        server_info->conn_list, client_info);
        __handle_l2cap_le_client_disconnected(server_info, client_info);
        client_info->watch_id = -1;
@@ -779,7 +780,8 @@ BT_EXPORT_API int bluetooth_l2cap_le_server_disconnect(int socket_fd)
                client_info->sock_fd = -1;
 
                /* Remove remote client info from l2cap_le server context */
-               server_info->conn_list = g_slist_remove(
+               if (server_info)
+                       server_info->conn_list = g_slist_remove(
                                server_info->conn_list, client_info);
 
                /* Release remote client info */