Commit cb87c41f282dccc1b3649e3ea3fb80d19f820310

Authored by Danny Al-Gaaf
1 parent 33492be5
Exists in master and in 3 other branches v2, v3, wip-18092

test/gf_unit.c: free memory after usage

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Showing 1 changed file with 13 additions and 7 deletions   Show diff stats
test/gf_unit.c
... ... @@ -141,15 +141,12 @@ int main(int argc, char **argv)
141 141 if (!gf_init_hard(&gf_def, w, GF_MULT_DEFAULT, GF_REGION_DEFAULT, GF_DIVIDE_DEFAULT,
142 142 (h->mult_type != GF_MULT_COMPOSITE) ? h->prim_poly : 0, 0, 0, NULL, NULL))
143 143 problem("No default for this value of w");
  144 +
144 145 if (w == 4) {
145 146 mult4 = gf_w4_get_mult_table(&gf);
146   - }
147   -
148   - if (w == 8) {
  147 + } else if (w == 8) {
149 148 mult8 = gf_w8_get_mult_table(&gf);
150   - }
151   -
152   - if (w == 16) {
  149 + } else if (w == 16) {
153 150 log16 = gf_w16_get_log_table(&gf);
154 151 alog16 = gf_w16_get_mult_alog_table(&gf);
155 152 }
... ... @@ -308,7 +305,6 @@ int main(int argc, char **argv)
308 305 gf_general_val_to_s(c, w, cs, 1);
309 306 printf("Error in single multiplication (all numbers in hex):\n\n");
310 307 printf(" gf.multiply(gf, %s, %s) = %s, which is clearly wrong.\n", as, bs, cs);
311   -;
312 308 exit(1);
313 309 }
314 310 }
... ... @@ -422,5 +418,15 @@ int main(int argc, char **argv)
422 418 gf_general_do_region_check(&gf, a, rc+s_start, rd+d_start, target+d_start, bytes, xor);
423 419 }
424 420 }
  421 +
  422 + free(a);
  423 + free(b);
  424 + free(c);
  425 + free(d);
  426 + free(ra);
  427 + free(rb);
  428 + free(rc);
  429 + free(rd);
  430 +
425 431 return 0;
426 432 }
... ...