mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Fix various potential memory leaks.
Though I expect most not to be exercised in practice.
This commit is contained in:
parent
c3a4454892
commit
0b97343ff7
29 changed files with 142 additions and 32 deletions
17
src/util.cc
17
src/util.cc
|
@ -902,24 +902,17 @@ const char* bro_magic_path()
|
|||
return path;
|
||||
}
|
||||
|
||||
const char* bro_prefixes()
|
||||
string bro_prefixes()
|
||||
{
|
||||
int len = 1; // room for \0
|
||||
loop_over_list(prefixes, i)
|
||||
len += strlen(prefixes[i]) + 1;
|
||||
|
||||
char* p = new char[len];
|
||||
string rval;
|
||||
|
||||
loop_over_list(prefixes, j)
|
||||
if ( j == 0 )
|
||||
strcpy(p, prefixes[j]);
|
||||
rval.append(prefixes[j]);
|
||||
else
|
||||
{
|
||||
strcat(p, ":");
|
||||
strcat(p, prefixes[j]);
|
||||
}
|
||||
rval.append(":").append(prefixes[j]);
|
||||
|
||||
return p;
|
||||
return rval;
|
||||
}
|
||||
|
||||
const char* PACKAGE_LOADER = "__load__.bro";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue