Skip to content

Commit

Permalink
Rewrite checking condition bufStart pointer NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanAizek committed Oct 31, 2022
1 parent 43de2aa commit 1b7f3c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions programs/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,8 @@ 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 */
Expand Down

0 comments on commit 1b7f3c4

Please sign in to comment.