]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Fix small perf issues reported by Coverity 16737/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 19 Jan 2026 11:13:19 +0000 (12:13 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 19 Jan 2026 11:13:19 +0000 (12:13 +0100)
Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/dnsdistdist/dnsdist-lua-bindings-dnsquestion.cc
pdns/dnsdistdist/dnsdist-web.cc

index 56a96b515285edcdd54ecd1a88efd9fbcf269c0b..219366db91045b705c5d7908826b8a7ea536239f 100644 (file)
@@ -327,14 +327,14 @@ void setupLuaBindingsDNSQuestion([[maybe_unused]] LuaContext& luaCtx)
     }
     ede.clearExisting = clearExistingEntries.value_or(true);
     if (ede.clearExisting) {
-      dnsQuestion.ids.d_extendedErrors = std::make_unique<std::vector<dnsdist::edns::SetExtendedDNSErrorOperation>>(std::initializer_list<dnsdist::edns::SetExtendedDNSErrorOperation>({ede}));
+      dnsQuestion.ids.d_extendedErrors = std::make_unique<std::vector<dnsdist::edns::SetExtendedDNSErrorOperation>>(std::initializer_list<dnsdist::edns::SetExtendedDNSErrorOperation>({std::move(ede)}));
     }
     else {
       if (!dnsQuestion.ids.d_extendedErrors) {
-        dnsQuestion.ids.d_extendedErrors = std::make_unique<std::vector<dnsdist::edns::SetExtendedDNSErrorOperation>>(std::initializer_list<dnsdist::edns::SetExtendedDNSErrorOperation>({ede}));
+        dnsQuestion.ids.d_extendedErrors = std::make_unique<std::vector<dnsdist::edns::SetExtendedDNSErrorOperation>>(std::initializer_list<dnsdist::edns::SetExtendedDNSErrorOperation>({std::move(ede)}));
       }
       else {
-        dnsQuestion.ids.d_extendedErrors->emplace_back(ede);
+        dnsQuestion.ids.d_extendedErrors->emplace_back(std::move(ede));
       }
     }
   });
index 836d3d3f230aa22794613df88b3720638d40b2a2..f122d52fce5da5b2218f787f3b17f8d41271daf2 100644 (file)
@@ -494,7 +494,7 @@ static void handlePrometheus(const YaHTTP::Request& req, YaHTTP::Response& resp)
   std::ostringstream output;
   std::string instanceLabel; // MUST be empty when instance label is not requested
   {
-    auto rtc = dnsdist::configuration::getCurrentRuntimeConfiguration();
+    const auto& rtc = dnsdist::configuration::getCurrentRuntimeConfiguration();
     instanceLabel = rtc.d_prometheusAddInstanceLabel ? "instance=\"" + rtc.d_server_id + "\"" : "";
   }
   static const std::set<std::string> metricBlacklist = {"special-memory-usage", "latency-count", "latency-sum"};