diff --git a/CHANGES b/CHANGES index a794b70a72..0c165cc4c4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,19 @@ +3.2.0-dev.44 | 2020-02-14 16:16:54 -0700 + + * RE: make the RE_Matcher destructor non-virtual (Max Kellermann) + + * analyzer/protocol/smtp: remove unnecessary nullptr check (Max Kellermann) + + * analyzer/Manager: remove unnecessary clear() calls from destructor (Max Kellermann) + + * analyzer/protocol/http: remove unnecessary empty destructor (Max Kellermann) + + * iosource/pcap/Source: remove unused fields `last_hdr`, `last_data` (Max Kellermann) + + * iosource/Manager: eliminate two std::string copies (Max Kellermann) + + 3.2.0-dev.37 | 2020-02-14 11:09:50 -0800 * Fix various format specifiers (Jon Siwek, Corelight) diff --git a/VERSION b/VERSION index d6c32b13ce..8c68c96215 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2.0-dev.37 +3.2.0-dev.44 diff --git a/src/RE.h b/src/RE.h index f1a2317659..7ff6df112c 100644 --- a/src/RE.h +++ b/src/RE.h @@ -174,12 +174,12 @@ protected: int current_pos; }; -class RE_Matcher { +class RE_Matcher final { public: RE_Matcher(); explicit RE_Matcher(const char* pat); RE_Matcher(const char* exact_pat, const char* anywhere_pat); - virtual ~RE_Matcher(); + ~RE_Matcher(); void AddPat(const char* pat); diff --git a/src/analyzer/Manager.cc b/src/analyzer/Manager.cc index 189a365263..0bcf690a74 100644 --- a/src/analyzer/Manager.cc +++ b/src/analyzer/Manager.cc @@ -70,9 +70,6 @@ Manager::~Manager() for ( analyzer_map_by_port::const_iterator i = analyzers_by_port_udp.begin(); i != analyzers_by_port_udp.end(); i++ ) delete i->second; - analyzers_by_port_udp.clear(); - analyzers_by_port_tcp.clear(); - // Clean up expected-connection table. while ( conns_by_timeout.size() ) { diff --git a/src/analyzer/protocol/http/HTTP.cc b/src/analyzer/protocol/http/HTTP.cc index 83349d100a..56359a177e 100644 --- a/src/analyzer/protocol/http/HTTP.cc +++ b/src/analyzer/protocol/http/HTTP.cc @@ -176,7 +176,6 @@ void HTTP_Entity::Deliver(int len, const char* data, int trailing_CRLF) class HTTP_Entity::UncompressedOutput : public analyzer::OutputHandler { public: UncompressedOutput(HTTP_Entity* e) { entity = e; } - virtual ~UncompressedOutput() { } virtual void DeliverStream(int len, const u_char* data, bool orig) { entity->DeliverBodyClear(len, (char*) data, false); diff --git a/src/analyzer/protocol/smtp/SMTP.cc b/src/analyzer/protocol/smtp/SMTP.cc index bdc6503ba1..2cd8148357 100644 --- a/src/analyzer/protocol/smtp/SMTP.cc +++ b/src/analyzer/protocol/smtp/SMTP.cc @@ -180,8 +180,7 @@ void SMTP_Analyzer::ProcessLine(int length, const char* line, bool orig) { // Don't know whether it is a command line or // a data line. - if ( line_after_gap ) - delete line_after_gap; + delete line_after_gap; line_after_gap = new BroString((const u_char *) line, length, 1); diff --git a/src/iosource/Manager.cc b/src/iosource/Manager.cc index 96fcaee522..6bfa1ad420 100644 --- a/src/iosource/Manager.cc +++ b/src/iosource/Manager.cc @@ -325,8 +325,8 @@ static std::pair split_prefix(std::string path) PktSrc* Manager::OpenPktSrc(const std::string& path, bool is_live) { std::pair t = split_prefix(path); - std::string prefix = t.first; - std::string npath = t.second; + const auto& prefix = t.first; + const auto& npath = t.second; // Find the component providing packet sources of the requested prefix. diff --git a/src/iosource/pcap/Source.cc b/src/iosource/pcap/Source.cc index 52d87bd3b8..fc9d5618c5 100644 --- a/src/iosource/pcap/Source.cc +++ b/src/iosource/pcap/Source.cc @@ -27,8 +27,6 @@ PcapSource::PcapSource(const std::string& path, bool is_live) props.is_live = is_live; pd = nullptr; memset(¤t_hdr, 0, sizeof(current_hdr)); - memset(&last_hdr, 0, sizeof(last_hdr)); - last_data = nullptr; } void PcapSource::Open() @@ -46,7 +44,6 @@ void PcapSource::Close() pcap_close(pd); pd = nullptr; - last_data = nullptr; Closed(); @@ -213,7 +210,6 @@ bool PcapSource::ExtractNextPacket(Packet* pkt) return false; } - last_data = data; pkt->Init(props.link_type, ¤t_hdr.ts, current_hdr.caplen, current_hdr.len, data); if ( current_hdr.len == 0 || current_hdr.caplen == 0 ) @@ -222,8 +218,6 @@ bool PcapSource::ExtractNextPacket(Packet* pkt) return false; } - last_hdr = current_hdr; - last_data = data; ++stats.received; stats.bytes_received += current_hdr.len; diff --git a/src/iosource/pcap/Source.h b/src/iosource/pcap/Source.h index fd2fa0ec53..f32071cb99 100644 --- a/src/iosource/pcap/Source.h +++ b/src/iosource/pcap/Source.h @@ -41,8 +41,6 @@ private: pcap_t *pd; struct pcap_pkthdr current_hdr; - struct pcap_pkthdr last_hdr; - const u_char* last_data; }; }