Skip to content

Commit

Permalink
Fix fs.scandir (introduced by Samsung#122)
Browse files Browse the repository at this point in the history
The check should be after the allocation, where it is.
It was misplaced and also duplicated the existing one.

libtuv-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
  • Loading branch information
robertsipka committed Aug 24, 2018
1 parent 46f0242 commit e8b0d0e
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/unix/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,13 +407,7 @@ static ssize_t uv__fs_scandir(uv_fs_t* req) {
cnt++;
}

if (cnt > 0 && dents == NULL) {
closedir(dir);
cnt = -1;
goto error;
}

/* Allcoate memory for the directory entries. */
/* Allocate memory for the directory entries. */
dents = (uv__dirent_t**) malloc(sizeof (uv__dirent_t*) * cnt);

if (cnt > 0 && dents == NULL) {
Expand Down

0 comments on commit e8b0d0e

Please sign in to comment.