mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix extfs leaking inode reference on readlink failure.
This commit is contained in:
parent
e0ee3017e1
commit
5444d1014e
1 changed files with 1 additions and 1 deletions
|
@ -630,7 +630,7 @@ void HandleReadlink(int chl, struct fsm_req_readlink* msg, Filesystem* fs)
|
|||
if ( fs->num_inodes <= msg->ino ) { RespondError(chl, EBADF); return; }
|
||||
Inode* inode = fs->GetInode((uint32_t) msg->ino);
|
||||
if ( !inode ) { RespondError(chl, errno); return; }
|
||||
if ( !EXT2_S_ISLNK(inode->Mode()) ) { RespondError(chl, EINVAL); return; }
|
||||
if ( !EXT2_S_ISLNK(inode->Mode()) ) { inode->Unref(); RespondError(chl, EINVAL); return; }
|
||||
size_t count = inode->Size();
|
||||
uint8_t* buf = (uint8_t*) malloc(count);
|
||||
if ( !buf ) { inode->Unref(); RespondError(chl, errno); return; }
|
||||
|
|
Loading…
Add table
Reference in a new issue