diff --git a/src/api/sockets.c b/src/api/sockets.c index 20819718..813e3e44 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -2140,7 +2140,8 @@ lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset, (exceptset && FD_ISSET(i, exceptset))) { struct lwip_sock *sock; SYS_ARCH_PROTECT(lev); - sock = tryget_socket_unconn_locked(i); + sock = tryget_socket_unconn_nouse(i); + LWIP_ASSERT("socket gone at the end of select", sock != NULL); if (sock != NULL) { /* for now, handle select_waiting==0... */ LWIP_ASSERT("sock->select_waiting > 0", sock->select_waiting > 0); @@ -2148,7 +2149,6 @@ lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset, sock->select_waiting--; } SYS_ARCH_UNPROTECT(lev); - done_socket(sock); } else { SYS_ARCH_UNPROTECT(lev); /* Not a valid socket */