Merge remote-tracking branch 'origin/topic/jsiwek/coverity-lint'

* origin/topic/jsiwek/coverity-lint:
  Avoid superfluous string copies when adding to zeek::detail::sig_files
  Initialize an RD_Decorate member via std::move
  Fix invalid iterator comparison in UseDefs::FindSuccUsage()
This commit is contained in:
Tim Wojtulewicz 2021-02-25 08:45:49 -07:00
commit b8ec65ccf7
5 changed files with 15 additions and 4 deletions

11
CHANGES
View file

@ -1,3 +1,14 @@
4.1.0-dev.266 | 2021-02-25 08:45:49 -0700
* Avoid superfluous string copies when adding to zeek::detail::sig_files
Coverity 1387015 (Jon Siwek, Corelight)
* Initialize an RD_Decorate member via std::move (Jon Siwek, Corelight)
* Fix invalid iterator comparison in UseDefs::FindSuccUsage()
Coverity 1447018 (Jon Siwek, Corelight)
4.1.0-dev.260 | 2021-02-24 15:52:31 -0800

View file

@ -1 +1 @@
4.1.0-dev.260
4.1.0-dev.266

View file

@ -357,7 +357,7 @@ when return TOK_WHEN;
zeek::reporter->Error("failed to find file associated with @load-sigs %s",
file);
else
zeek::detail::sig_files.push_back(zeek::util::copy_string(path.c_str()));
zeek::detail::sig_files.push_back(std::move(path));
break;
case 0:

View file

@ -50,7 +50,7 @@ private:
class RD_Decorate : public TraversalCallback {
public:
RD_Decorate(std::shared_ptr<ProfileFunc> _pf) : pf(_pf)
RD_Decorate(std::shared_ptr<ProfileFunc> _pf) : pf(std::move(_pf))
{ }
// Traverses the given function body, using the first two

View file

@ -444,7 +444,7 @@ UDs UseDefs::FindSuccUsage(const Stmt* s) const
auto uds = no_succ ? nullptr : FindUsage(succ->second);
auto succ2 = successor2.find(s);
auto no_succ2 = (succ2 == successor.end() || ! succ2->second);
auto no_succ2 = (succ2 == successor2.end() || ! succ2->second);
auto uds2 = no_succ2 ? nullptr : FindUsage(succ2->second);
if ( uds && uds2 )