Fix wrong allocation failure check in dscandir_r(3).

This commit is contained in:
Jonas 'Sortie' Termansen 2014-03-30 23:23:59 +02:00
parent 8d41d3ceb0
commit 3c160977bf
1 changed files with 1 additions and 1 deletions

View File

@ -70,7 +70,7 @@ int scandir(const char* path, struct dirent*** namelist_ptr,
size_t name_length = strlen(entry->d_name);
size_t dirent_size = sizeof(struct dirent) + name_length + 1;
struct dirent* dirent = (struct dirent*) malloc(dirent_size);
if ( !dirent_size )
if ( !dirent )
goto out_error;
memcpy(dirent, entry, sizeof(*entry));
strcpy(dirent->d_name, entry->d_name);