From 8a610004f6ac5bf5966b8a16da5a240d289b538b Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Sun, 12 Apr 2015 09:42:58 +0100 Subject: [PATCH] Fixed a few coverity warnings --- programs/bench.c | 3 ++- programs/fullbench.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/programs/bench.c b/programs/bench.c index 8921f09..d3b060c 100644 --- a/programs/bench.c +++ b/programs/bench.c @@ -287,7 +287,7 @@ int BMK_benchFiles(const char** fileNamesTable, int nbFiles, int cLevel) inFileSize = BMK_GetFileSize(inFileName); if (inFileSize==0) { DISPLAY( "file is empty\n"); fclose(inFile); return 11; } benchedSize = (size_t) BMK_findMaxMem(inFileSize * 2) / 2; - if (benchedSize==0) { DISPLAY( "not enough memory\n"); return 11; } + if (benchedSize==0) { DISPLAY( "not enough memory\n"); fclose(inFile); return 11; } if ((U64)benchedSize > inFileSize) benchedSize = (size_t)inFileSize; if (benchedSize < inFileSize) { @@ -376,6 +376,7 @@ int BMK_benchFiles(const char** fileNamesTable, int nbFiles, int cLevel) } milliTime = BMK_GetMilliSpan(milliTime); + nbLoops += !nbLoops; /* avoid division by zero */ if ((double)milliTime < fastestC*nbLoops) fastestC = (double)milliTime/nbLoops; cSize=0; for (chunkNb=0; chunkNb