Add some additional std::moves reported by Coverity

This commit is contained in:
Tim Wojtulewicz 2025-07-23 11:22:49 -07:00
parent 2ce26f1be0
commit 205c72d26f
19 changed files with 27 additions and 26 deletions

View file

@ -216,7 +216,8 @@ bool Manager::PermitUnknownProtocol(const std::string& analyzer, uint32_t protoc
++count;
if ( count == 1 )
zeek::detail::timer_mgr->Add(new UnknownProtocolTimer(run_state::network_time, p, unknown_sampling_duration));
zeek::detail::timer_mgr->Add(
new UnknownProtocolTimer(run_state::network_time, std::move(p), unknown_sampling_duration));
if ( count < unknown_sampling_threshold )
return true;

View file

@ -24,7 +24,7 @@ function register_packet_analyzer%(parent: PacketAnalyzer::Tag, identifier: coun
if ( ! child_analyzer )
return zeek::val_mgr->False();
parent_analyzer->RegisterProtocol(identifier, child_analyzer);
parent_analyzer->RegisterProtocol(identifier, std::move(child_analyzer));
return zeek::val_mgr->True();
%}
@ -45,7 +45,7 @@ function try_register_packet_analyzer_by_name%(parent: string, identifier: count
if ( ! child_analyzer )
return zeek::val_mgr->False();
parent_analyzer->RegisterProtocol(identifier, child_analyzer);
parent_analyzer->RegisterProtocol(identifier, std::move(child_analyzer));
return zeek::val_mgr->True();
%}
@ -74,7 +74,7 @@ function register_protocol_detection%(parent: PacketAnalyzer::Tag, child: Packet
if ( ! child_analyzer )
return zeek::val_mgr->False();
parent_analyzer->RegisterProtocolDetection(child_analyzer);
parent_analyzer->RegisterProtocolDetection(std::move(child_analyzer));
return zeek::val_mgr->True();
%}

View file

@ -111,7 +111,7 @@ bool IPAnalyzer::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet)
}
// If we got here, the IP_Hdr is most likely valid and safe to use.
packet->ip_hdr = ip_hdr;
packet->ip_hdr = std::move(ip_hdr);
// If there's an encapsulation stack in this packet, meaning this packet is part of a chain
// of tunnels, make sure to store the IP header in the last flow in the stack so it can be