]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Prevent a copy when inserting a tag
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 18 Nov 2022 15:57:09 +0000 (16:57 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 6 Dec 2022 11:18:25 +0000 (12:18 +0100)
pdns/dnsdist.hh

index 698aee212e5c398921f91a042230d59085bce929..b7c7e63ee92e758c35fea34163adcceb67399ede 100644 (file)
@@ -121,11 +121,11 @@ struct DNSQuestion
     return !(protocol == dnsdist::Protocol::DoUDP || protocol == dnsdist::Protocol::DNSCryptUDP);
   }
 
-  void setTag(const std::string& key, std::string&& value) {
+  void setTag(std::string&& key, std::string&& value) {
     if (!qTag) {
       qTag = std::make_unique<QTag>();
     }
-    qTag->insert_or_assign(key, std::move(value));
+    qTag->insert_or_assign(std::move(key), std::move(value));
   }
 
   void setTag(const std::string& key, const std::string& value) {