sockets: Fix potential race when socket is closed already

Ref IDF-4794
This commit is contained in:
xueyunfei
2022-03-31 09:44:55 +02:00
committed by David Cermak
parent 8188897ee6
commit 95d63b3ef5
+4
View File
@@ -443,6 +443,10 @@ tryget_socket_unconn_locked(int fd)
{
struct lwip_sock *ret = tryget_socket_unconn_nouse(fd);
if (ret != NULL) {
#if ESP_LWIP
if (ret->conn == NULL)
return NULL;
#endif /* ESP_LWIP */
if (!sock_inc_used_locked(ret)) {
return NULL;
}