From 8010d6706e9a5d51a2ab4e6b54e2aa5566f2705c Mon Sep 17 00:00:00 2001 From: goldsimon Date: Thu, 19 Nov 2015 07:33:55 +0100 Subject: [PATCH] fixed bug #46471: lwip_accept() leaks socket descriptors if new netconn was already closed because of peer behavior --- CHANGELOG | 4 ++++ src/api/sockets.c | 1 + 2 files changed, 5 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 652b6d41..30b1f4bb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -296,6 +296,10 @@ HISTORY ++ Bugfixes: + 2015-11-19: fix by Kerem Hadimli + * sockets.c: fixed bug #46471: lwip_accept() leaks socket descriptors if new + netconn was already closed because of peer behavior + 2015-11-12: fix by Valery Ushakov * tcp_in.c: fixed bug #46365 tcp_accept_null() should call tcp_abort() diff --git a/src/api/sockets.c b/src/api/sockets.c index 617861a5..60f38b11 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -556,6 +556,7 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen) if (err != ERR_OK) { LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): netconn_peer failed, err=%d\n", s, err)); netconn_delete(newconn); + free_socket(nsock, 1); sock_set_errno(sock, err_to_errno(err)); return -1; }