Skip to content

Commit

Permalink
perf: initialize variant list to zero (fix for #55)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablodelara committed Jun 8, 2020
1 parent 1924002 commit feaa28a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion perf/ipsec_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2225,6 +2225,7 @@ run_tests(void *arg)
fprintf(stderr, "Cannot allocate memory\n");
goto exit_failure;
}
memset(variant_list, 0, total_variants * sizeof(struct variant_s));

at_size = NUM_RUNS * params.num_sizes * sizeof(uint64_t);
for (variant = 0, variant_ptr = variant_list;
Expand Down Expand Up @@ -2294,8 +2295,12 @@ run_tests(void *arg)
return;
#endif
exit_failure:
if (variant_list != NULL)
if (variant_list != NULL) {
/* Freeing variants list */
for (i = 0; i < total_variants; i++)
free(variant_list[i].avg_times);
free(variant_list);
}
free_mem(&buf, &keys);
free_mb_mgr(p_mgr);
exit(EXIT_FAILURE);
Expand Down

0 comments on commit feaa28a

Please sign in to comment.