From: prasadam kumar Date: Thu, 23 Jul 2020 05:20:54 +0000 (+0530) Subject: Added mutex lock to fix the crash issue X-Git-Tag: accepted/tizen/unified/20200727.131959^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=183911ce891119292d1ada2464e6fd71a157f023;p=platform%2Fcore%2Fapi%2Fconnection.git Added mutex lock to fix the crash issue Change-Id: Ib5fa112a23c5f23331495eaa6b4a87d01e8a2a41 Signed-off-by: prasadam kumar --- diff --git a/src/libnetwork.c b/src/libnetwork.c index 8b225e5..a3d9ed8 100755 --- a/src/libnetwork.c +++ b/src/libnetwork.c @@ -171,7 +171,18 @@ static void __libnet_evt_cb(net_event_info_t *event_cb, void *user_data) { bool is_requested = false; connection_error_e result = CONNECTION_ERROR_NONE; - connection_handle_s *conn_handle = (connection_handle_s *)user_data; + CONN_LOCK; + connection_handle_s conn_handle_local; + connection_handle_s *conn_handle = &conn_handle_local; + connection_handle_s *conn_handle_origin = (connection_handle_s *)user_data; + + if(!_connection_check_handle_validity(conn_handle_origin)) { + CONNECTION_LOG(CONNECTION_INFO, "Invalid handle"); + CONN_UNLOCK; + return; + } + memcpy(conn_handle, conn_handle_origin, sizeof(connection_handle_s)); + CONN_UNLOCK; switch (event_cb->Event) { case NET_EVENT_OPEN_RSP: