Skip to content

Commit

Permalink
Update free before return
Browse files Browse the repository at this point in the history
Signed-off-by: Shivshankar-Reddy <[email protected]>
  • Loading branch information
Shivshankar-Reddy committed May 24, 2024
1 parent d72ba06 commit a7acaaf
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/unit/test_crc64combine.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,35 @@ int test_crc64combine(int argc, char **argv, int flags) {

/* get the single-character version for single-byte Redis behavior */
set_crc64_cutoffs(0, crc64_test_size+1);
if (bench_crc64(data, crc64_test_size, passes, expect, "crc_1byte", csv)) return 1;
if (bench_crc64(data, crc64_test_size, passes, expect, "crc_1byte", csv)) {
zfree(data);
data = NULL;
return 1;
}

set_crc64_cutoffs(crc64_test_size+1, crc64_test_size+1);
/* run with 8-byte "single" path, crcfaster */
if (bench_crc64(data, crc64_test_size, passes, expect, "crcspeed", csv)) return 1;
if (bench_crc64(data, crc64_test_size, passes, expect, "crcspeed", csv)) {
zfree(data);
data = NULL;
return 1;
}

/* run with dual 8-byte paths */
set_crc64_cutoffs(1, crc64_test_size+1);
if (bench_crc64(data, crc64_test_size, passes, expect, "crcdual", csv)) return 1;
if (bench_crc64(data, crc64_test_size, passes, expect, "crcdual", csv)) {
zfree(data);
data = NULL;
return 1;
}

/* run with tri 8-byte paths */
set_crc64_cutoffs(1, 1);
if (bench_crc64(data, crc64_test_size, passes, expect, "crctri", csv)) return 1;
if (bench_crc64(data, crc64_test_size, passes, expect, "crctri", csv)) {
zfree(data);
data = NULL;
return 1;
}

/* Be free memory region, be free. */
zfree(data);
Expand Down

0 comments on commit a7acaaf

Please sign in to comment.