summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibC/dirent.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibC/dirent.cpp b/Userland/Libraries/LibC/dirent.cpp
index fe902a32ce..35d6ce394b 100644
--- a/Userland/Libraries/LibC/dirent.cpp
+++ b/Userland/Libraries/LibC/dirent.cpp
@@ -278,6 +278,9 @@ int scandir(const char* dir_name,
const int size = tmp_names.size();
auto** names = static_cast<struct dirent**>(kmalloc_array(size, sizeof(struct dirent*)));
+ if (names == nullptr) {
+ return -1;
+ }
for (auto i = 0; i < size; i++) {
names[i] = tmp_names[i];
}