From fae84c77f3cd88d9e7ccfc39a1fa04ad80f7f540 Mon Sep 17 00:00:00 2001 From: Amir Shalem Date: Sun, 4 Dec 2016 11:15:34 -0800 Subject: [PATCH] Fix potential double close() on exception Summary: Fix potential double close() on exception when SO_REUSEPORT fails. The fd will be closed twice, once by close() and second by the scope guard above. Reviewed By: yfeldblum Differential Revision: D4272300 fbshipit-source-id: a163be822d7522cadb9dc3c3eddca10df453de14 --- folly/io/async/AsyncUDPSocket.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/folly/io/async/AsyncUDPSocket.cpp b/folly/io/async/AsyncUDPSocket.cpp index 0cf9d8cf..082f7994 100644 --- a/folly/io/async/AsyncUDPSocket.cpp +++ b/folly/io/async/AsyncUDPSocket.cpp @@ -88,7 +88,6 @@ void AsyncUDPSocket::bind(const folly::SocketAddress& address) { SO_REUSEPORT, &value, sizeof(value)) != 0) { - ::close(socket); throw AsyncSocketException(AsyncSocketException::NOT_OPEN, "failed to put socket in reuse_port mode", errno); -- 2.34.1