vfs: inode: fix null pointer deref
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
3ca769014c
commit
7b13316e90
1 changed files with 4 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue