Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Commit

Permalink
Fix fs.scandir (introduced by #122) (#124)
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 [email protected]
  • Loading branch information
robertsipka authored and yichoi committed Aug 24, 2018
1 parent 46f0242 commit 0bfc04d
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 0bfc04d

Please sign in to comment.