no need to track tableBuf

free() is compatible with NULL,
let's free() unconditionnally
This commit is contained in:
Yann Collet
2019-10-25 17:34:29 -07:00
parent 8e414b586d
commit 5fb84ca2cf
3 changed files with 22 additions and 31 deletions
+1 -9
View File
@@ -566,7 +566,6 @@ int main(int argCount, const char* argv[])
nextArgumentIsMaxDict = 0,
nextArgumentIsDictID = 0,
nextArgumentsAreFiles = 0,
isTableBufferBased = 0,
nextEntryIsDictionary = 0,
operationResult = 0,
separateFiles = 0,
@@ -827,7 +826,6 @@ int main(int argCount, const char* argv[])
concatenatedTables = UTIL_concatenateTwoTables(curTable, extendedTable);
if (!concatenatedTables) {
if (!isTableBufferBased) curTable->buf = NULL;
UTIL_freeFileNamesTable(curTable);
UTIL_freeFileNamesTable(extendedTable);
CLEAN_RETURN(badusage(programName));
@@ -842,8 +840,6 @@ int main(int argCount, const char* argv[])
concatenatedTables->buf = NULL;
UTIL_freeFileNamesTable(concatenatedTables);
isTableBufferBased = 1; /* file names are now in heap */
continue;
}
/* fall-through, will trigger bad_usage() later on */
@@ -1253,11 +1249,7 @@ int main(int argCount, const char* argv[])
_end:
FIO_freePreferences(prefs);
if(filenameTable) {
if(isTableBufferBased && tableBuf){
free(tableBuf);
}
}
free(tableBuf);
if (main_pause) waitEnter();
#ifdef UTIL_HAS_CREATEFILELIST