From 66666948f98e4fc5e5011431986772e1dd652197 Mon Sep 17 00:00:00 2001 From: xueyunfei Date: Mon, 20 Jan 2020 17:14:44 +0800 Subject: [PATCH] sockets: Fix free-select-locked after udp close ESP_LWIP supports closing socket while waiting. This fixes potential races. Orig: fix bug for after udp close select_waiting assert (dd3b3017) Ref IDF-4794 --- src/api/sockets.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/api/sockets.c b/src/api/sockets.c index d2ca56498..2d4c9b4a6 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -565,6 +565,9 @@ free_socket_locked(struct lwip_sock *sock, int is_tcp, struct netconn **conn, *lastdata = sock->lastdata; sock->lastdata.pbuf = NULL; +#if ESP_LWIP + sock->select_waiting = 0; +#endif /* ESP_LWIP */ *conn = sock->conn; sock->conn = NULL; return 1;