Fix extfs leaking inode reference on readlink failure.
This commit is contained in:
parent
e0ee3017e1
commit
5444d1014e
|
@ -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; }
|
if ( fs->num_inodes <= msg->ino ) { RespondError(chl, EBADF); return; }
|
||||||
Inode* inode = fs->GetInode((uint32_t) msg->ino);
|
Inode* inode = fs->GetInode((uint32_t) msg->ino);
|
||||||
if ( !inode ) { RespondError(chl, errno); return; }
|
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();
|
size_t count = inode->Size();
|
||||||
uint8_t* buf = (uint8_t*) malloc(count);
|
uint8_t* buf = (uint8_t*) malloc(count);
|
||||||
if ( !buf ) { inode->Unref(); RespondError(chl, errno); return; }
|
if ( !buf ) { inode->Unref(); RespondError(chl, errno); return; }
|
||||||
|
|
Loading…
Reference in New Issue