mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:47:35 +00:00
LibC: Fix scandir
not checking for allocation failure
This commit is contained in:
parent
1af072e0f3
commit
adfdb63e02
1 changed files with 3 additions and 0 deletions
|
@ -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];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue