From: Remi Gacogne Date: Thu, 28 Oct 2021 08:44:49 +0000 (+0200) Subject: dnsdist: Remove unreachable code in HTTP/2 connections cleanup X-Git-Tag: dnsdist-1.7.0-beta1~5^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf4b17d99109fb9c43c576dc9042cf1737e6b9e0;p=thirdparty%2Fpdns.git dnsdist: Remove unreachable code in HTTP/2 connections cleanup Reported by Coverity (CID 373724). --- diff --git a/pdns/dnsdistdist/dnsdist-nghttp2.cc b/pdns/dnsdistdist/dnsdist-nghttp2.cc index a059f462a0..e7ac86f64c 100644 --- a/pdns/dnsdistdist/dnsdist-nghttp2.cc +++ b/pdns/dnsdistdist/dnsdist-nghttp2.cc @@ -933,9 +933,8 @@ void DownstreamDoHConnectionsManager::cleanupClosedConnections(struct timeval no if ((*connIt)->isUsable()) { ++connIt; } - else { - connIt = dsIt->second.erase(connIt); - } + + connIt = dsIt->second.erase(connIt); } if (!dsIt->second.empty()) { @@ -988,8 +987,7 @@ std::shared_ptr DownstreamDoHConnectionsManager::getConn return entry; } - /* otherwise let's try the next one, if any */ - ++listIt; + listIt = list.erase(listIt); } } } diff --git a/pdns/dnsdistdist/dnsdist-tcp-downstream.cc b/pdns/dnsdistdist/dnsdist-tcp-downstream.cc index 30a065441b..acf55d7249 100644 --- a/pdns/dnsdistdist/dnsdist-tcp-downstream.cc +++ b/pdns/dnsdistdist/dnsdist-tcp-downstream.cc @@ -805,13 +805,8 @@ std::shared_ptr DownstreamConnectionsManager::getConnect ++ds->tcpReusedConnections; return entry; } - else { - listIt = list.erase(listIt); - continue; - } - /* otherwise let's try the next one, if any */ - ++listIt; + listIt = list.erase(listIt); } } } @@ -858,9 +853,8 @@ void DownstreamConnectionsManager::cleanupClosedTCPConnections(struct timeval no if ((*connIt)->isUsable()) { ++connIt; } - else { - connIt = dsIt->second.erase(connIt); - } + + connIt = dsIt->second.erase(connIt); } if (!dsIt->second.empty()) {