Fix/improve dereference-before-null-checks.

This commit is contained in:
Jon Siwek 2013-09-13 16:41:41 -05:00
parent 3d81432a1e
commit 735d2c402a
8 changed files with 19 additions and 30 deletions

View file

@ -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;