mirror of
https://github.com/facebook/zstd.git
synced 2025-07-30 22:23:13 +03:00
Static analyze fix
This commit is contained in:
@ -122,7 +122,7 @@ int UTIL_checkFilenameCollisions(char** dstFilenameTable, unsigned nbFiles) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UTIL_createDestinationDirTable(char** dstFilenameTable, const char** filenameTable,
|
void UTIL_createDestinationDirTable(char** dstFilenameTable, const char** filenameTable,
|
||||||
const unsigned nbFiles, const char* outDirName, const int compressing)
|
const unsigned nbFiles, const char* outDirName)
|
||||||
{
|
{
|
||||||
unsigned u;
|
unsigned u;
|
||||||
const char* c;
|
const char* c;
|
||||||
@ -147,11 +147,10 @@ void UTIL_createDestinationDirTable(char** dstFilenameTable, const char** filena
|
|||||||
}
|
}
|
||||||
|
|
||||||
finalPathLen += strlen(filename);
|
finalPathLen += strlen(filename);
|
||||||
dstFilenameTable[u] = compressing ?
|
dstFilenameTable[u] = (char*) malloc((finalPathLen+2) * sizeof(char));
|
||||||
(char*) malloc((finalPathLen+6) * sizeof(char)) /* 4 more bytes for .zst suffix */
|
|
||||||
: (char*) malloc((finalPathLen+2) * sizeof(char));
|
|
||||||
if (!dstFilenameTable[u]) {
|
if (!dstFilenameTable[u]) {
|
||||||
UTIL_DISPLAYLEVEL(1, "Unable to allocate space for file destination str\n");
|
UTIL_DISPLAYLEVEL(1, "Unable to allocate space for file destination str\n");
|
||||||
|
free(filename);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ int UTIL_compareStr(const void *p1, const void *p2);
|
|||||||
int UTIL_checkFilenameCollisions(char** dstFilenameTable, unsigned nbFiles);
|
int UTIL_checkFilenameCollisions(char** dstFilenameTable, unsigned nbFiles);
|
||||||
/* Populates dstFilenameTable using outDirName concatenated with entries from filenameTable */
|
/* Populates dstFilenameTable using outDirName concatenated with entries from filenameTable */
|
||||||
void UTIL_createDestinationDirTable(char** dstFilenameTable, const char** filenameTable, const unsigned nbFiles,
|
void UTIL_createDestinationDirTable(char** dstFilenameTable, const char** filenameTable, const unsigned nbFiles,
|
||||||
const char* outDirName, const int compressing);
|
const char* outDirName);
|
||||||
void UTIL_freeDestinationFilenameTable(char** dstDirTable, unsigned nbFiles);
|
void UTIL_freeDestinationFilenameTable(char** dstDirTable, unsigned nbFiles);
|
||||||
|
|
||||||
U32 UTIL_isLink(const char* infilename);
|
U32 UTIL_isLink(const char* infilename);
|
||||||
|
@ -1179,7 +1179,7 @@ int main(int argCount, const char* argv[])
|
|||||||
if (UTIL_isDirectory(outDirName)) {
|
if (UTIL_isDirectory(outDirName)) {
|
||||||
DISPLAY("Output of files will be in directory: %s\n", outDirName);
|
DISPLAY("Output of files will be in directory: %s\n", outDirName);
|
||||||
dstFilenameTable = (char**)malloc(filenameIdx * sizeof(char*));
|
dstFilenameTable = (char**)malloc(filenameIdx * sizeof(char*));
|
||||||
UTIL_createDestinationDirTable(dstFilenameTable, filenameTable, filenameIdx, outDirName, 1);
|
UTIL_createDestinationDirTable(dstFilenameTable, filenameTable, filenameIdx, outDirName);
|
||||||
} else {
|
} else {
|
||||||
DISPLAY("%s is not a directory!\n", outDirName);
|
DISPLAY("%s is not a directory!\n", outDirName);
|
||||||
CLEAN_RETURN(1);
|
CLEAN_RETURN(1);
|
||||||
@ -1211,7 +1211,7 @@ int main(int argCount, const char* argv[])
|
|||||||
if (UTIL_isDirectory(outDirName)) {
|
if (UTIL_isDirectory(outDirName)) {
|
||||||
DISPLAY("Output of files will be in directory: %s\n", outDirName);
|
DISPLAY("Output of files will be in directory: %s\n", outDirName);
|
||||||
dstFilenameTable = (char**)malloc(filenameIdx * sizeof(char*));
|
dstFilenameTable = (char**)malloc(filenameIdx * sizeof(char*));
|
||||||
UTIL_createDestinationDirTable(dstFilenameTable, filenameTable, filenameIdx, outDirName, 1);
|
UTIL_createDestinationDirTable(dstFilenameTable, filenameTable, filenameIdx, outDirName);
|
||||||
} else {
|
} else {
|
||||||
DISPLAY("%s is not a directory!\n", outDirName);
|
DISPLAY("%s is not a directory!\n", outDirName);
|
||||||
CLEAN_RETURN(1);
|
CLEAN_RETURN(1);
|
||||||
|
Reference in New Issue
Block a user