From e37aff3d23452f86e0174688ab045186c7fef6ad Mon Sep 17 00:00:00 2001 From: Anuj Jain Date: Mon, 13 Jun 2022 19:14:06 +0530 Subject: [PATCH] Fix Dereferencing of NULL pointer error Change-Id: Ia3e1e098401ffe0e3ff4ec23b4bae601be570c08 Signed-off-by: Anuj Jain --- bt-api/bt-l2cap-le-server.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bt-api/bt-l2cap-le-server.c b/bt-api/bt-l2cap-le-server.c index 350ebe3..c86dfe3 100644 --- a/bt-api/bt-l2cap-le-server.c +++ b/bt-api/bt-l2cap-le-server.c @@ -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 */ -- 2.7.4