From 64bd681a0e26f0d7ab761564ea8d07bc144d671e Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Wed, 1 Nov 2023 16:07:11 +0100 Subject: [PATCH] rec: fix coverity 1523746 and 1523745 Fixing a use_after_move and a copy_instead_of_move --- pdns/recursordist/recursor_cache.cc | 2 +- pdns/recursordist/syncres.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pdns/recursordist/recursor_cache.cc b/pdns/recursordist/recursor_cache.cc index b2e8fe1a7e..95cfdc1658 100644 --- a/pdns/recursordist/recursor_cache.cc +++ b/pdns/recursordist/recursor_cache.cc @@ -140,7 +140,7 @@ static void updateDNSSECValidationStateFromCache(boost::optional& state, } template -static void ptrAssign(T* ptr, T value) +static void ptrAssign(T* ptr, const T& value) { if (ptr != nullptr) { *ptr = value; diff --git a/pdns/recursordist/syncres.cc b/pdns/recursordist/syncres.cc index 8300e1c19e..7b5963e24c 100644 --- a/pdns/recursordist/syncres.cc +++ b/pdns/recursordist/syncres.cc @@ -2327,7 +2327,7 @@ void SyncRes::getBestNSFromCache(const DNSName& qname, const QType qtype, vector auto insertionPair = beenthere.insert(std::move(answer)); if (!insertionPair.second) { brokeloop = true; - LOG(prefix << qname << ": We have NS in cache for '" << subdomain << "' but part of LOOP (already seen " << answer.qname << ")! Trying less specific NS" << endl); + LOG(prefix << qname << ": We have NS in cache for '" << subdomain << "' but part of LOOP (already seen " << insertionPair.first->qname << ")! Trying less specific NS" << endl); ; if (doLog()) for (set::const_iterator j = beenthere.begin(); j != beenthere.end(); ++j) { -- 2.47.2