From 2c896042b978781b9a2f499825c693a43f6ee7b3 Mon Sep 17 00:00:00 2001 From: Mark Zealey Date: Mon, 13 Jan 2014 11:36:50 +0200 Subject: [PATCH] close socket if bind fails to fix coverity leak issues --- pdns/nameserver.cc | 2 ++ pdns/tcpreceiver.cc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/pdns/nameserver.cc b/pdns/nameserver.cc index 04d9027010..1be9663eba 100644 --- a/pdns/nameserver.cc +++ b/pdns/nameserver.cc @@ -128,6 +128,7 @@ void UDPNameserver::bindIPv4() g_localaddresses.push_back(locala); if(::bind(s, (sockaddr*)&locala, locala.getSocklen()) < 0) { + close(s); if( errno == EADDRNOTAVAIL && ! ::arg().mustDo("local-address-nonexist-fail") ) { L<