Skip to content

Commit

Permalink
Handle out-of-memory condition in grokdir() call to strdup().
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianlopezroche committed Jul 23, 2018
1 parent d4abb94 commit c671a2b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fdupes.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,13 @@ int grokdir(char *dir, file_t **filelistp)

if (ISFLAG(flags, F_EXCLUDEHIDDEN)) {
fullname = strdup(newfile->d_name);
if (fullname == 0)
{
errormsg("out of memory!\n");
free(newfile);
closedir(cd);
exit(1);
}
name = basename(fullname);
if (name[0] == '.' && strcmp(name, ".") && strcmp(name, "..") ) {
free(newfile->d_name);
Expand Down

0 comments on commit c671a2b

Please sign in to comment.