From 6a4583542a735b016c7fa36e51c3460bde24b055 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Fri, 18 Dec 2015 02:51:14 +0100 Subject: [PATCH] fixed asan warning --- programs/playTests.sh | 3 +++ programs/zstdcli.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/programs/playTests.sh b/programs/playTests.sh index afffd5eb53b..5d641ec598d 100755 --- a/programs/playTests.sh +++ b/programs/playTests.sh @@ -39,9 +39,12 @@ echo frame concatenation test completed echo "**** flush write error test **** " +echo "echo foo | $ZSTD > /dev/full" echo foo | $ZSTD > /dev/full && die "write error not detected!" +echo "echo foo | $ZSTD | $ZSTD -d > /dev/full" echo foo | $ZSTD | $ZSTD -d > /dev/full && die "write error not detected!" + echo "*** dictionary tests *** " ./datagen > tmpDict diff --git a/programs/zstdcli.c b/programs/zstdcli.c index 1526e0ea64a..b218d3a2ca0 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -192,7 +192,7 @@ int main(int argCount, const char** argv) /* init */ (void)rangeBench; /* not used when ZSTD_NOBENCH set */ - filenameTable = (const char**)malloc(argCount * sizeof(const char*)); + filenameTable = (const char**)malloc(argCount * sizeof(const char*)); /* argCount >= 1 */ if (filenameTable==NULL) { DISPLAY("not enough memory\n"); exit(1); } memset(filenameTable, 0, argCount * sizeof(const char*)); displayOut = stderr; @@ -359,7 +359,7 @@ int main(int argCount, const char** argv) if (!strcmp(filenameTable[0], stdinmark) && IS_CONSOLE(stdin) ) return badusage(programName); /* No output filename ==> try to select one automatically (when possible) */ - outFileName = filenameTable[1]; + if (filenameIdx>=2) outFileName = filenameTable[1]; while (!outFileName) /* while : just to allow break statement */ { if (!IS_CONSOLE(stdout)) { outFileName=stdoutmark; break; } /* Default to stdout whenever possible (i.e. not a console) */