Skip to content

Commit

Permalink
sockets: Fix potential race when socket is closed already
Browse files Browse the repository at this point in the history
Ref IDF-4794
  • Loading branch information
freakyxue authored and david-cermak committed Aug 16, 2022
1 parent d058bbb commit 882716f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/api/sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 882716f

Please sign in to comment.