mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Fix new/malloc/delete/free mismatches in Dictionary code
This commit is contained in:
parent
d566b8ca31
commit
37d3cfbd44
2 changed files with 4 additions and 4 deletions
|
@ -567,7 +567,7 @@ void Dictionary::Clear()
|
||||||
delete_func(table[i].value);
|
delete_func(table[i].value);
|
||||||
table[i].Clear();
|
table[i].Clear();
|
||||||
}
|
}
|
||||||
delete [] table;
|
free(table);
|
||||||
table = nullptr;
|
table = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -731,7 +731,7 @@ void* Dictionary::Insert(void* key, int key_size, zeek::detail::hash_t hash, voi
|
||||||
v = table[position].value;
|
v = table[position].value;
|
||||||
table[position].value = val;
|
table[position].value = val;
|
||||||
if ( ! copy_key )
|
if ( ! copy_key )
|
||||||
delete (char*)key;
|
delete [] (char*)key;
|
||||||
|
|
||||||
if ( order )
|
if ( order )
|
||||||
{//set new v to order too.
|
{//set new v to order too.
|
||||||
|
|
|
@ -90,7 +90,7 @@ public:
|
||||||
{
|
{
|
||||||
memcpy(key_here, arg_key, key_size);
|
memcpy(key_here, arg_key, key_size);
|
||||||
if ( ! copy_key )
|
if ( ! copy_key )
|
||||||
delete (char*)arg_key; //own the arg_key, now don't need it.
|
delete [] (char*)arg_key; //own the arg_key, now don't need it.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -123,7 +123,7 @@ public:
|
||||||
void Clear()
|
void Clear()
|
||||||
{
|
{
|
||||||
if( key_size > 8 )
|
if( key_size > 8 )
|
||||||
delete key;
|
delete [] key;
|
||||||
SetEmpty();
|
SetEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue