mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 01:58:20 +00:00
Fix malloc/delete mismatch.
This commit is contained in:
parent
c4e8908c8e
commit
742a047a40
1 changed files with 2 additions and 4 deletions
|
@ -2090,9 +2090,7 @@ HashKey* Manager::HashValues(const int num_elements, const Value* const *vals)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
int position = 0;
|
int position = 0;
|
||||||
char *data = (char*) malloc(length);
|
char *data = new char[length];
|
||||||
if ( data == 0 )
|
|
||||||
reporter->InternalError("Could not malloc?");
|
|
||||||
|
|
||||||
for ( int i = 0; i < num_elements; i++ )
|
for ( int i = 0; i < num_elements; i++ )
|
||||||
{
|
{
|
||||||
|
@ -2108,7 +2106,7 @@ HashKey* Manager::HashValues(const int num_elements, const Value* const *vals)
|
||||||
}
|
}
|
||||||
|
|
||||||
HashKey *key = new HashKey(data, length);
|
HashKey *key = new HashKey(data, length);
|
||||||
delete data;
|
delete [] data;
|
||||||
|
|
||||||
assert(position == length);
|
assert(position == length);
|
||||||
return key;
|
return key;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue