mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Fix/improve dereference-before-null-checks.
This commit is contained in:
parent
3d81432a1e
commit
735d2c402a
8 changed files with 19 additions and 30 deletions
11
src/Desc.cc
11
src/Desc.cc
|
@ -23,11 +23,7 @@ ODesc::ODesc(desc_type t, BroFile* arg_f)
|
|||
size = DEFAULT_SIZE;
|
||||
base = safe_malloc(size);
|
||||
((char*) base)[0] = '\0';
|
||||
|
||||
offset = 0;
|
||||
|
||||
if ( ! base )
|
||||
OutOfMemory();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -337,16 +333,9 @@ void ODesc::Grow(unsigned int n)
|
|||
{
|
||||
size *= 2;
|
||||
base = safe_realloc(base, size);
|
||||
if ( ! base )
|
||||
OutOfMemory();
|
||||
}
|
||||
}
|
||||
|
||||
void ODesc::OutOfMemory()
|
||||
{
|
||||
reporter->InternalError("out of memory");
|
||||
}
|
||||
|
||||
void ODesc::Clear()
|
||||
{
|
||||
offset = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue