gf_inline_time.c: fix memory leak

Free all with malloc allocated memory before exit. Change
if checks against 'w' to be a if-else check to prevent checking
after already matched.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
master
Danny Al-Gaaf 2014-05-13 19:06:13 +02:00
parent 9d53ea590b
commit 33492be5db
1 changed files with 6 additions and 4 deletions

View File

@ -116,8 +116,7 @@ int main(int argc, char **argv)
printf("Inline mult: %10.6lf s Mops: %10.3lf %10.3lf Mega-ops/s\n", printf("Inline mult: %10.6lf s Mops: %10.3lf %10.3lf Mega-ops/s\n",
elapsed, dnum/1024.0/1024.0, dnum/1024.0/1024.0/elapsed); elapsed, dnum/1024.0/1024.0, dnum/1024.0/1024.0/elapsed);
} } else if (w == 8) {
if (w == 8) {
mult8 = gf_w8_get_mult_table(&gf); mult8 = gf_w8_get_mult_table(&gf);
if (mult8 == NULL) { if (mult8 == NULL) {
printf("Couldn't get inline multiplication table.\n"); printf("Couldn't get inline multiplication table.\n");
@ -139,8 +138,7 @@ int main(int argc, char **argv)
} }
printf("Inline mult: %10.6lf s Mops: %10.3lf %10.3lf Mega-ops/s\n", printf("Inline mult: %10.6lf s Mops: %10.3lf %10.3lf Mega-ops/s\n",
elapsed, dnum/1024.0/1024.0, dnum/1024.0/1024.0/elapsed); elapsed, dnum/1024.0/1024.0, dnum/1024.0/1024.0/elapsed);
} } else if (w == 16) {
if (w == 16) {
log16 = gf_w16_get_log_table(&gf); log16 = gf_w16_get_log_table(&gf);
alog16 = gf_w16_get_mult_alog_table(&gf); alog16 = gf_w16_get_mult_alog_table(&gf);
if (log16 == NULL) { if (log16 == NULL) {
@ -164,5 +162,9 @@ int main(int argc, char **argv)
printf("Inline mult: %10.6lf s Mops: %10.3lf %10.3lf Mega-ops/s\n", printf("Inline mult: %10.6lf s Mops: %10.3lf %10.3lf Mega-ops/s\n",
elapsed, dnum/1024.0/1024.0, dnum/1024.0/1024.0/elapsed); elapsed, dnum/1024.0/1024.0, dnum/1024.0/1024.0/elapsed);
} }
free (ra);
free (rb);
free (ra16);
free (rb16);
return 0; return 0;
} }