mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +00:00
Fix misc. Coverity warnings
This commit is contained in:
parent
47235b57a6
commit
6255ab6584
5 changed files with 13 additions and 12 deletions
4
CHANGES
4
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
|
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)
|
* Deprecate int/uint{8,16,32,64} typedefs, replace with actual cstdint types (Tim Wojtulewicz, Corelight)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
3.1.0-dev.54
|
3.1.0-dev.55
|
||||||
|
|
13
src/Debug.cc
13
src/Debug.cc
|
@ -320,12 +320,11 @@ vector<ParseLocationRec> parse_location_string(const string& s)
|
||||||
vector<ParseLocationRec> result;
|
vector<ParseLocationRec> result;
|
||||||
result.push_back(ParseLocationRec());
|
result.push_back(ParseLocationRec());
|
||||||
ParseLocationRec& plr = result[0];
|
ParseLocationRec& plr = result[0];
|
||||||
const char* full_filename = 0;
|
|
||||||
|
|
||||||
// If plrFileAndLine, set this to the filename you want; for
|
// If plrFileAndLine, set this to the filename you want; for
|
||||||
// memory management reasons, the real filename is set when looking
|
// memory management reasons, the real filename is set when looking
|
||||||
// up the line number to find the corresponding statement.
|
// 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) )
|
if ( sscanf(s.c_str(), "%d", &plr.line) )
|
||||||
{ // just a line number (implicitly referring to the current file)
|
{ // just a line number (implicitly referring to the current file)
|
||||||
|
@ -357,7 +356,7 @@ vector<ParseLocationRec> parse_location_string(const string& s)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
loc_filename = copy_string(path.c_str());
|
loc_filename = path;
|
||||||
plr.type = plrFileAndLine;
|
plr.type = plrFileAndLine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -367,12 +366,11 @@ vector<ParseLocationRec> parse_location_string(const string& s)
|
||||||
auto iter = g_dbgfilemaps.find(loc_filename);
|
auto iter = g_dbgfilemaps.find(loc_filename);
|
||||||
if ( iter == g_dbgfilemaps.end() )
|
if ( iter == g_dbgfilemaps.end() )
|
||||||
reporter->InternalError("Policy file %s should have been loaded\n",
|
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);
|
debug_msg("No line %d in %s.\n", plr.line, loc_filename.data());
|
||||||
delete [] full_filename;
|
|
||||||
plr.type = plrUnknown;
|
plr.type = plrUnknown;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -399,7 +397,6 @@ vector<ParseLocationRec> parse_location_string(const string& s)
|
||||||
plr.stmt = 0;
|
plr.stmt = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] full_filename;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,6 +204,7 @@ RuleMatcher::RuleMatcher(int arg_RE_level)
|
||||||
root = new RuleHdrTest(RuleHdrTest::NOPROT, 0, 0, RuleHdrTest::EQ,
|
root = new RuleHdrTest(RuleHdrTest::NOPROT, 0, 0, RuleHdrTest::EQ,
|
||||||
new maskedvalue_list);
|
new maskedvalue_list);
|
||||||
RE_level = arg_RE_level;
|
RE_level = arg_RE_level;
|
||||||
|
parse_error = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RuleMatcher::~RuleMatcher()
|
RuleMatcher::~RuleMatcher()
|
||||||
|
|
|
@ -171,10 +171,9 @@ ID* install_ID(const char* name, const char* module_name,
|
||||||
else
|
else
|
||||||
scope = SCOPE_FUNCTION;
|
scope = SCOPE_FUNCTION;
|
||||||
|
|
||||||
string full_name_str = make_full_var_name(module_name, name);
|
string full_name = make_full_var_name(module_name, name);
|
||||||
char* full_name = copy_string(full_name_str.c_str());
|
|
||||||
|
|
||||||
ID* id = new ID(full_name, scope, is_export);
|
ID* id = new ID(full_name.data(), scope, is_export);
|
||||||
if ( SCOPE_FUNCTION != scope )
|
if ( SCOPE_FUNCTION != scope )
|
||||||
global_scope()->Insert(full_name, id);
|
global_scope()->Insert(full_name, id);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue