mirror of
https://github.com/facebook/zstd
synced 2026-08-22 22:32:07 -04:00
Rewrite checking condition bufStart pointer NULL
This commit is contained in:
parent
43de2aa17d
commit
5334339421
1 changed files with 5 additions and 2 deletions
|
|
@ -693,8 +693,11 @@ static int UTIL_prepareFileList(const char *dirName,
|
|||
ptrdiff_t newListSize = (*bufEnd - *bufStart) + LIST_SIZE_INCREASE;
|
||||
assert(newListSize >= 0);
|
||||
*bufStart = (char*)UTIL_realloc(*bufStart, (size_t)newListSize);
|
||||
*bufEnd = *bufStart + newListSize;
|
||||
if (*bufStart == NULL) { free(path); closedir(dir); return 0; }
|
||||
if (*bufStart != NULL) {
|
||||
*bufEnd = *bufStart + newListSize;
|
||||
} else {
|
||||
free(path); closedir(dir); return 0;
|
||||
}
|
||||
}
|
||||
if (*bufStart + *pos + pathLength < *bufEnd) {
|
||||
memcpy(*bufStart + *pos, path, pathLength + 1); /* with final \0 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue