mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 04:28:20 +00:00
Improve/standardize some malloc/realloc return val checks.
This commit is contained in:
parent
4b059ea15a
commit
d7d5497436
5 changed files with 17 additions and 7 deletions
|
@ -537,17 +537,19 @@ bool Manager::TraverseRecord(Stream* stream, Filter* filter, RecordType* rt,
|
|||
|
||||
filter->indices.push_back(new_indices);
|
||||
|
||||
filter->fields = (threading::Field**)
|
||||
void* tmp =
|
||||
realloc(filter->fields,
|
||||
sizeof(threading::Field*) * ++filter->num_fields);
|
||||
sizeof(threading::Field*) * (filter->num_fields + 1));
|
||||
|
||||
if ( ! filter->fields )
|
||||
if ( ! tmp )
|
||||
{
|
||||
--filter->num_fields;
|
||||
reporter->Error("out of memory in add_filter");
|
||||
return false;
|
||||
}
|
||||
|
||||
++filter->num_fields;
|
||||
filter->fields = (threading::Field**) tmp;
|
||||
|
||||
TypeTag st = TYPE_VOID;
|
||||
|
||||
if ( t->Tag() == TYPE_TABLE )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue