From 90a440eafd5d1068a0f78e3edfdf897f16e496ad Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Wed, 11 Oct 2023 21:23:32 +0200 Subject: [PATCH] sockets: fix socket leak when using setsockopt/getsockopt hook with LWIP_NETCONN_FULLDUPLEX==1 see bug #63458 --- src/api/sockets.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/api/sockets.c b/src/api/sockets.c index fbce282a0..ddf37ab73 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -2977,6 +2977,7 @@ lwip_getsockopt_impl(int s, int level, int optname, void *optval, socklen_t *opt #ifdef LWIP_HOOK_SOCKETS_GETSOCKOPT if (LWIP_HOOK_SOCKETS_GETSOCKOPT(s, sock, level, optname, optval, optlen, &err)) { + done_socket(sock); return err; } #endif @@ -3398,6 +3399,7 @@ lwip_setsockopt_impl(int s, int level, int optname, const void *optval, socklen_ #ifdef LWIP_HOOK_SOCKETS_SETSOCKOPT if (LWIP_HOOK_SOCKETS_SETSOCKOPT(s, sock, level, optname, optval, optlen, &err)) { + done_socket(sock); return err; } #endif