1
0
mirror of https://github.com/facebook/zstd.git synced 2025-07-29 11:21:22 +03:00

fixed asan warning

This commit is contained in:
Yann Collet
2015-12-18 02:51:14 +01:00
parent 17d188fa38
commit 6a4583542a
2 changed files with 5 additions and 2 deletions

View File

@ -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) */