Skip to content

Odin_II: fix leak appearing when IPO is enabled #875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions ODIN_II/SRC/adders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,10 @@ void init_split_adder(nnode_t *node, nnode_t *ptr, int a, int sizea, int b, int
*-------------------------------------------------------------------------*/
void init_add_distribution()
{
int i, j;
oassert(hard_adders != NULL);
j = hard_adders->inputs->size + hard_adders->inputs->next->size;
adder = (int *)vtr::malloc(sizeof(int) * (j + 1));
for (i = 0; i <= j; i++)
adder[i] = 0;
return;

int len = hard_adders->inputs->size + hard_adders->inputs->next->size + 1;
adder = (int *)vtr::calloc(len, sizeof(int));
}

/*---------------------------------------------------------------------------
Expand Down Expand Up @@ -121,7 +118,7 @@ void report_add_distribution()
printf("\n");
printf("\nGeometric mean adder/subtractor chain length: %.2f\n", geomean_addsub_length);

return;
vtr::free(adder);
}

/*---------------------------------------------------------------------------
Expand Down
12 changes: 4 additions & 8 deletions ODIN_II/SRC/multipliers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ int min_mult = 0;
int *mults = NULL;

void record_mult_distribution(nnode_t *node);
void terminate_mult_distribution();
void init_split_multiplier(nnode_t *node, nnode_t *ptr, int offa, int a, int offb, int b, nnode_t *node_a, nnode_t *node_b);
void init_multiplier_adder(nnode_t *node, nnode_t *parent, int a, int b);
void split_multiplier_a(nnode_t *node, int a0, int a1, int b);
Expand Down Expand Up @@ -275,14 +276,9 @@ void instantiate_simple_soft_multiplier(nnode_t *node, short mark, netlist_t *ne
*-------------------------------------------------------------------------*/
void init_mult_distribution()
{
int i, j;

oassert(hard_multipliers != NULL);
mults = (int *)vtr::malloc(sizeof(int) * (hard_multipliers->inputs->size + 1) * (1 + hard_multipliers->inputs->next->size));
for (i = 0; i <= hard_multipliers->inputs->size; i++)
for (j = 0; j <= hard_multipliers->inputs->next->size; j++)
mults[i * hard_multipliers->inputs->size + j] = 0;
return;
int len = ( 1 + hard_multipliers->inputs->size ) * ( 1 + hard_multipliers->inputs->next->size );
mults = (int *)vtr::calloc(len, sizeof(int));
}

/*---------------------------------------------------------------------------
Expand Down Expand Up @@ -327,7 +323,7 @@ void report_mult_distribution()
}
printf("\n");
printf("\nTotal # of multipliers = %ld\n", num_total);
return;
vtr::free(mults);
}

/*---------------------------------------------------------------------------
Expand Down