diff --git a/CHANGES b/CHANGES index 9f86e8d5ff..3d0864f17d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,8 @@ +3.1.0-dev.55 | 2019-08-14 16:18:44 -0700 + + * Fix misc. Coverity warnings (Jon Siwek, Corelight) + 3.1.0-dev.54 | 2019-08-14 15:38:02 -0700 * Deprecate int/uint{8,16,32,64} typedefs, replace with actual cstdint types (Tim Wojtulewicz, Corelight) diff --git a/VERSION b/VERSION index 000fb1f16c..55167bdd27 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.1.0-dev.54 +3.1.0-dev.55 diff --git a/src/Debug.cc b/src/Debug.cc index 5f6c3bd7fb..d06996b3ce 100644 --- a/src/Debug.cc +++ b/src/Debug.cc @@ -320,12 +320,11 @@ vector parse_location_string(const string& s) vector result; result.push_back(ParseLocationRec()); ParseLocationRec& plr = result[0]; - const char* full_filename = 0; // If plrFileAndLine, set this to the filename you want; for // memory management reasons, the real filename is set when looking // up the line number to find the corresponding statement. - const char* loc_filename = 0; + std::string loc_filename; if ( sscanf(s.c_str(), "%d", &plr.line) ) { // just a line number (implicitly referring to the current file) @@ -357,7 +356,7 @@ vector parse_location_string(const string& s) return result; } - loc_filename = copy_string(path.c_str()); + loc_filename = path; plr.type = plrFileAndLine; } } @@ -367,12 +366,11 @@ vector parse_location_string(const string& s) auto iter = g_dbgfilemaps.find(loc_filename); if ( iter == g_dbgfilemaps.end() ) reporter->InternalError("Policy file %s should have been loaded\n", - loc_filename); + loc_filename.data()); - if ( plr.line > how_many_lines_in(loc_filename) ) + if ( plr.line > how_many_lines_in(loc_filename.data()) ) { - debug_msg("No line %d in %s.\n", plr.line, loc_filename); - delete [] full_filename; + debug_msg("No line %d in %s.\n", plr.line, loc_filename.data()); plr.type = plrUnknown; return result; } @@ -399,7 +397,6 @@ vector parse_location_string(const string& s) plr.stmt = 0; } - delete [] full_filename; return result; } diff --git a/src/RuleMatcher.cc b/src/RuleMatcher.cc index db81b2890d..88779f0050 100644 --- a/src/RuleMatcher.cc +++ b/src/RuleMatcher.cc @@ -204,6 +204,7 @@ RuleMatcher::RuleMatcher(int arg_RE_level) root = new RuleHdrTest(RuleHdrTest::NOPROT, 0, 0, RuleHdrTest::EQ, new maskedvalue_list); RE_level = arg_RE_level; + parse_error = false; } RuleMatcher::~RuleMatcher() diff --git a/src/Scope.cc b/src/Scope.cc index b445ce0e53..662a86fda7 100644 --- a/src/Scope.cc +++ b/src/Scope.cc @@ -171,10 +171,9 @@ ID* install_ID(const char* name, const char* module_name, else scope = SCOPE_FUNCTION; - string full_name_str = make_full_var_name(module_name, name); - char* full_name = copy_string(full_name_str.c_str()); + string full_name = make_full_var_name(module_name, name); - ID* id = new ID(full_name, scope, is_export); + ID* id = new ID(full_name.data(), scope, is_export); if ( SCOPE_FUNCTION != scope ) global_scope()->Insert(full_name, id); else