vfs: inode: fix null pointer deref

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-07-05 14:18:07 +02:00
commit 7b13316e90

View file

@ -24,6 +24,10 @@ int inode_populate_dirents(inode_t *inode)
for (size_t i = 0; i < n; i++) {
dirent_t *dent = dents + i;
dirent_t *insert = kalloc(sizeof(dirent_t), ALLOC_KERN);
if (!insert) {
kerr("failed to allocate dirent! memory leak likely\n");
return -ENOMEM;
}
memcpy(insert, dent, sizeof(dirent_t));
list_insert(&inode->dirents, insert);