Skip to content

Commit

Permalink
Fix malloc/delete mismatch.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiwek committed Aug 29, 2013
1 parent c4e8908 commit 742a047
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/input/Manager.cc
Expand Up @@ -2090,9 +2090,7 @@ HashKey* Manager::HashValues(const int num_elements, const Value* const *vals)
return NULL;

int position = 0;
char *data = (char*) malloc(length);
if ( data == 0 )
reporter->InternalError("Could not malloc?");
char *data = new char[length];

for ( int i = 0; i < num_elements; i++ )
{
Expand All @@ -2108,7 +2106,7 @@ HashKey* Manager::HashValues(const int num_elements, const Value* const *vals)
}

HashKey *key = new HashKey(data, length);
delete data;
delete [] data;

assert(position == length);
return key;
Expand Down

0 comments on commit 742a047

Please sign in to comment.