summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>2014-05-13 19:06:13 +0200
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>2014-05-13 19:06:13 +0200
commit33492be5db5d801d8fab5d0e01fc2c372c6ec9f6 (patch)
tree3af8c2e85d5e7b2c7301b25e7d33e3edbe922cf0
parent9d53ea590b243170900d82111f6f04d75977e1cb (diff)
downloadgf-complete-33492be5db5d801d8fab5d0e01fc2c372c6ec9f6.tar.gz
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>
-rw-r--r--tools/gf_inline_time.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/gf_inline_time.c b/tools/gf_inline_time.c
index c81e8a9..f8119da 100644
--- a/tools/gf_inline_time.c
+++ b/tools/gf_inline_time.c
@@ -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",
elapsed, dnum/1024.0/1024.0, dnum/1024.0/1024.0/elapsed);
- }
- if (w == 8) {
+ } else if (w == 8) {
mult8 = gf_w8_get_mult_table(&gf);
if (mult8 == NULL) {
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",
elapsed, dnum/1024.0/1024.0, dnum/1024.0/1024.0/elapsed);
- }
- if (w == 16) {
+ } else if (w == 16) {
log16 = gf_w16_get_log_table(&gf);
alog16 = gf_w16_get_mult_alog_table(&gf);
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",
elapsed, dnum/1024.0/1024.0, dnum/1024.0/1024.0/elapsed);
}
+ free (ra);
+ free (rb);
+ free (ra16);
+ free (rb16);
return 0;
}