From 327cb04f44a650afd3907701513b1c2e851a3b45 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Wed, 8 Apr 2015 09:20:21 +0100 Subject: [PATCH] minor memory leak fix and test --- programs/Makefile | 1 + programs/lz4cli.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/programs/Makefile b/programs/Makefile index 3ca46d7..9585c9f 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -250,6 +250,7 @@ test-mem: lz4 datagen fuzzer frametest fullbench ./datagen -g16MB > tmp valgrind --leak-check=yes ./lz4 -9 -B5D -f tmp tmp2 valgrind --leak-check=yes ./lz4 -t tmp2 + valgrind --leak-check=yes ./lz4 -bi1 tmp valgrind --leak-check=yes ./fullbench -i1 tmp ./datagen -g256MB > tmp valgrind --leak-check=yes ./lz4 -B4D -f -vq tmp $(VOID) diff --git a/programs/lz4cli.c b/programs/lz4cli.c index 888f21e..2870c97 100644 --- a/programs/lz4cli.c +++ b/programs/lz4cli.c @@ -470,7 +470,12 @@ int main(int argc, char** argv) if (!strcmp(input_filename, stdinmark) && IS_CONSOLE(stdin) ) badusage(); /* Check if benchmark is selected */ - if (bench) return BMK_benchFiles(inFileNames, ifnIdx, cLevel); + if (bench) + { + int bmkResult = BMK_benchFiles(inFileNames, ifnIdx, cLevel); + free(inFileNames); + return bmkResult; + } /* No output filename ==> try to select one automatically (when possible) */ while (!output_filename) -- 2.7.4