From 840aeab5b9d0197fdfc50fa2f3b06e66b850f892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Wed, 22 Jan 2014 17:36:25 +0100 Subject: [PATCH] NetEndpoint: Don't forget to close socket in error case. CID 1162792 --- src/kits/network/libnetapi/NetEndpoint.cpp | 1 + 1 file changed, 1 insertion(+) 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; }