Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a97cada

Browse files
sdamghanjeanlego
authored andcommittedOct 18, 2019
simulation mem leak - latch names array in create latch (#996)
* latch names array didn't free before * do strdup for two unincluded names in freeing and free all of them * remove extra comment
1 parent 2df20a2 commit a97cada

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎ODIN_II/SRC/read_blif.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,12 +368,12 @@ void create_latch_node_and_driver(FILE *file, Hashtable *output_nets_hash)
368368

369369
/* add names and type information to the created input pins */
370370
npin_t *new_pin = allocate_npin();
371-
new_pin->name = names[0];
371+
new_pin->name = vtr::strdup(names[0]);
372372
new_pin->type = INPUT;
373373
add_input_pin_to_node(new_node, new_pin,0);
374374

375375
new_pin = allocate_npin();
376-
new_pin->name = names[3];
376+
new_pin->name = vtr::strdup(names[3]);
377377
new_pin->type = INPUT;
378378
add_input_pin_to_node(new_node, new_pin,1);
379379

@@ -399,6 +399,9 @@ void create_latch_node_and_driver(FILE *file, Hashtable *output_nets_hash)
399399
output_nets_hash->add(new_node->name, new_net);
400400

401401
/* Free the char** names */
402+
for (i = 0; i < input_token_count; i++)
403+
vtr::free(names[i]);
404+
402405
vtr::free(names);
403406
vtr::free(ptr);
404407
}

0 commit comments

Comments
 (0)
Please sign in to comment.