coverity 169271 - take care about sockfd of -1 on close
authorAndy Green <andy@warmcat.com>
Sun, 28 Aug 2016 01:54:30 +0000 (09:54 +0800)
committerAndy Green <andy@warmcat.com>
Sun, 28 Aug 2016 01:54:30 +0000 (09:54 +0800)
lib/libwebsockets.c

index c475d6a9bec9dae6390f687cd1c612755c928187..f62c156174cfe24eb150ca229f5d50d88bb9f712 100755 (executable)
@@ -420,7 +420,8 @@ just_kill_connection:
        lws_remove_from_timeout_list(wsi);
 
        /* checking return redundant since we anyway close */
-       remove_wsi_socket_from_fds(wsi);
+       if (wsi->sock != LWS_SOCK_INVALID)
+               remove_wsi_socket_from_fds(wsi);
 
        wsi->state = LWSS_DEAD_SOCKET;