diff --git a/crc/crc16_t10dif_copy_perf.c b/crc/crc16_t10dif_copy_perf.c index 689f9f9..bc6059f 100644 --- a/crc/crc16_t10dif_copy_perf.c +++ b/crc/crc16_t10dif_copy_perf.c @@ -81,5 +81,10 @@ main(int argc, char *argv[]) perf_print(start, (long long) TEST_LEN); printf("finish 0x%x\n", crc); + + // Free allocated memory + aligned_free(src); + aligned_free(dst); + return 0; } diff --git a/crc/crc16_t10dif_copy_test.c b/crc/crc16_t10dif_copy_test.c index 8e33ee7..55c8efe 100644 --- a/crc/crc16_t10dif_copy_test.c +++ b/crc/crc16_t10dif_copy_test.c @@ -133,7 +133,6 @@ main(int argc, char *argv[]) dst_raw = (u8 *) malloc(TEST_LEN); if (NULL == dst_raw) { printf("alloc error: Fail"); - aligned_free(src_raw); return -1; } src = src_raw; diff --git a/crc/crc16_t10dif_op_perf.c b/crc/crc16_t10dif_op_perf.c index 353ab69..f32de5b 100644 --- a/crc/crc16_t10dif_op_perf.c +++ b/crc/crc16_t10dif_op_perf.c @@ -114,5 +114,10 @@ main(int argc, char *argv[]) perf_print(start, (long long) sizeof(blks->data) * NBLOCKS); printf("finish 0x%x\n", crc); + + // Free allocated memory + aligned_free(blks); + aligned_free(blks_ext); + return 0; } diff --git a/crc/crc16_t10dif_perf.c b/crc/crc16_t10dif_perf.c index c3fcd4a..a398121 100644 --- a/crc/crc16_t10dif_perf.c +++ b/crc/crc16_t10dif_perf.c @@ -77,5 +77,7 @@ main(int argc, char *argv[]) perf_print(start, (long long) TEST_LEN); printf("finish 0x%x\n", crc); + + aligned_free(buf); return 0; } diff --git a/crc/crc32_gzip_refl_perf.c b/crc/crc32_gzip_refl_perf.c index 3242287..a792f16 100644 --- a/crc/crc32_gzip_refl_perf.c +++ b/crc/crc32_gzip_refl_perf.c @@ -88,5 +88,6 @@ main(int argc, char *argv[]) printf("finish 0x%x\n", crc); + aligned_free(buf); return 0; } diff --git a/crc/crc32_ieee_perf.c b/crc/crc32_ieee_perf.c index 733747a..e08192c 100644 --- a/crc/crc32_ieee_perf.c +++ b/crc/crc32_ieee_perf.c @@ -77,5 +77,7 @@ main(int argc, char *argv[]) perf_print(start, (long long) TEST_LEN); printf("finish 0x%x\n", crc); + + aligned_free(buf); return 0; } diff --git a/crc/crc32_iscsi_perf.c b/crc/crc32_iscsi_perf.c index e754da5..6134680 100644 --- a/crc/crc32_iscsi_perf.c +++ b/crc/crc32_iscsi_perf.c @@ -77,5 +77,9 @@ main(int argc, char *argv[]) perf_print(start, (long long) TEST_LEN); printf("finish 0x%x\n", crc); + + // Free allocated memory + aligned_free(buf); + return 0; } diff --git a/crc/crc64_funcs_perf.c b/crc/crc64_funcs_perf.c index 91c8f7c..537e3e1 100644 --- a/crc/crc64_funcs_perf.c +++ b/crc/crc64_funcs_perf.c @@ -105,5 +105,8 @@ main(int argc, char *argv[]) printf("finish 0x%" PRIx64 "\n", crc); } + // Free allocated memory + aligned_free(buf); + return 0; } diff --git a/erasure_code/erasure_code_base_perf.c b/erasure_code/erasure_code_base_perf.c index bbc8caa..b777324 100644 --- a/erasure_code/erasure_code_base_perf.c +++ b/erasure_code/erasure_code_base_perf.c @@ -174,5 +174,14 @@ main(int argc, char *argv[]) perf_print(start, (long long) (TEST_LEN(m)) * (k + nerrs)); printf("done all: Pass\n"); + + // Free allocated buffers + for (i = 0; i < m; i++) { + aligned_free(buffs[i]); + } + for (i = 0; i < (m - k); i++) { + aligned_free(temp_buffs[i]); + } + return 0; } diff --git a/erasure_code/erasure_code_base_test.c b/erasure_code/erasure_code_base_test.c index bbd5bc2..8a4808c 100644 --- a/erasure_code/erasure_code_base_test.c +++ b/erasure_code/erasure_code_base_test.c @@ -763,5 +763,16 @@ main(int argc, char *argv[]) } printf("done EC tests: Pass\n"); + + for (i = 0; i < TEST_SOURCES; i++) { + aligned_free(buffs[i]); + } + for (i = 0; i < TEST_SOURCES; i++) { + aligned_free(temp_buffs[i]); + } + free(encode_matrix); + free(decode_matrix); + free(invert_matrix); + free(g_tbls); return 0; } diff --git a/erasure_code/gf_vect_dot_prod_base_test.c b/erasure_code/gf_vect_dot_prod_base_test.c index e06ae5a..6bbb5fd 100644 --- a/erasure_code/gf_vect_dot_prod_base_test.c +++ b/erasure_code/gf_vect_dot_prod_base_test.c @@ -295,5 +295,14 @@ main(int argc, char *argv[]) } printf("done all: Pass\n"); + + // Free allocated memory + for (i = 0; i < TEST_SOURCES; i++) { + aligned_free(buffs[i]); + } + aligned_free(dest); + aligned_free(dest_ref); + aligned_free(temp_buff); + return 0; } diff --git a/examples/ec/ec_piggyback_example.c b/examples/ec/ec_piggyback_example.c index 9fb27eb..12e9ac0 100644 --- a/examples/ec/ec_piggyback_example.c +++ b/examples/ec/ec_piggyback_example.c @@ -437,6 +437,18 @@ main(int argc, char *argv[]) } printf(" } done all: Pass\n"); + free(encode_matrix); + free(decode_matrix); + free(invert_matrix); + free(temp_matrix); + free(g_tbls); + for (i = 0; i < k; i++) + free(frag_ptrs[i]); + for (i = 0; i < p2; i++) + free(parity_ptrs[i]); + for (i = 0; i < p2; i++) + free(recover_outp[i]); + return 0; } diff --git a/examples/ec/ec_simple_example.c b/examples/ec/ec_simple_example.c index e93b3a3..d02bb93 100644 --- a/examples/ec/ec_simple_example.c +++ b/examples/ec/ec_simple_example.c @@ -210,6 +210,22 @@ main(int argc, char *argv[]) } printf(" } done all: Pass\n"); + + // Free allocated memory + free(encode_matrix); + free(decode_matrix); + free(invert_matrix); + free(temp_matrix); + free(g_tbls); + + for (i = 0; i < m; i++) { + free(frag_ptrs[i]); + } + + for (i = 0; i < p; i++) { + free(recover_outp[i]); + } + return 0; } diff --git a/mem/mem_zero_detect_perf.c b/mem/mem_zero_detect_perf.c index 688222a..ad0b4a2 100644 --- a/mem/mem_zero_detect_perf.c +++ b/mem/mem_zero_detect_perf.c @@ -55,5 +55,6 @@ main(int argc, char *argv[]) printf("mem_zero_detect_perf" TEST_TYPE_STR ": "); perf_print(start, (long long) TEST_LEN); + aligned_free(buf); return 0; } diff --git a/raid/pq_gen_perf.c b/raid/pq_gen_perf.c index 50b190b..24b09aa 100644 --- a/raid/pq_gen_perf.c +++ b/raid/pq_gen_perf.c @@ -84,5 +84,8 @@ main(int argc, char *argv[]) printf("pq_gen" TEST_TYPE_STR ": "); perf_print(start, (long long) TEST_MEM); + for (i = 0; i < TEST_SOURCES + 2; i++) + aligned_free(buffs[i]); + return 0; } diff --git a/raid/xor_example.c b/raid/xor_example.c index 21742e3..263577e 100644 --- a/raid/xor_example.c +++ b/raid/xor_example.c @@ -75,7 +75,6 @@ main(int argc, char *argv[]) ret = -1; exit: for (i = 0; i < TEST_SOURCES + 1; i++) - free(buffs[i]); - + aligned_free(buffs[i]); return ret; } diff --git a/raid/xor_gen_perf.c b/raid/xor_gen_perf.c index 886d732..fda5e20 100644 --- a/raid/xor_gen_perf.c +++ b/raid/xor_gen_perf.c @@ -88,5 +88,8 @@ main(int argc, char *argv[]) printf("xor_gen" TEST_TYPE_STR ": "); perf_print(start, (long long) TEST_MEM); + for (i = 0; i < TEST_SOURCES + 1; i++) + aligned_free(buffs[i]); + return fail; }