lwip: Fix leak when accept() fails due to max socket limit

As reported https://esp32.com/viewtopic.php?f=14&t=6171

event_callback() in sockets.c calls conn->socket-- to register
activity on a netconn which may not have any socket yet,
so any socket value < 0 indicates "no controlling socket"
for the netconn.
This commit is contained in:
Angus Gratton 2018-06-21 15:22:48 +10:00 committed by Angus Gratton
parent b47c8fcbf7
commit df816f4940

View file

@ -139,7 +139,7 @@ netconn_new_with_proto_and_callback(enum netconn_type t, u8_t proto, netconn_cal
static inline bool is_created_by_socket(struct netconn *conn)
{
#if LWIP_SOCKET
if (conn && (conn->socket != -1)) {
if (conn && (conn->socket >= 0)) {
return true;
}
#endif