Added mutex lock to fix the crash issue 45/239245/3 accepted/tizen/unified/20200727.131959 submit/tizen/20200727.053527
authorprasadam kumar <prasadam.p@samsung.com>
Thu, 23 Jul 2020 05:20:54 +0000 (10:50 +0530)
committerprasadam kumar <prasadam.p@samsung.com>
Thu, 23 Jul 2020 11:45:24 +0000 (17:15 +0530)
Change-Id: Ib5fa112a23c5f23331495eaa6b4a87d01e8a2a41
Signed-off-by: prasadam kumar <prasadam.p@samsung.com>
src/libnetwork.c

index 8b225e5..a3d9ed8 100755 (executable)
@@ -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: