diff --git a/src/kits/network/libnetapi/NetEndpoint.cpp b/src/kits/network/libnetapi/NetEndpoint.cpp index 80bbe9b236..12750d169f 100644 --- a/src/kits/network/libnetapi/NetEndpoint.cpp +++ b/src/kits/network/libnetapi/NetEndpoint.cpp @@ -454,6 +454,7 @@ BNetEndpoint::Accept(int32 timeout) socklen_t localAddressSize = sizeof(localAddress); if (getsockname(socket, (struct sockaddr *)&localAddress, &localAddressSize) < 0) { + close(socket); fStatus = errno; return NULL; }