From: Otto Moerbeek Date: Wed, 1 Nov 2023 15:07:11 +0000 (+0100) Subject: rec: fix coverity 1523746 and 1523745 X-Git-Tag: rec-5.0.0-beta1~17^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F13443%2Fhead;p=thirdparty%2Fpdns.git rec: fix coverity 1523746 and 1523745 Fixing a use_after_move and a copy_instead_of_move --- 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) {