nfs4: Fix CID 991494: memory leak if acquiring a lock fails
This commit is contained in:
@@ -755,8 +755,10 @@ Inode::AcquireLock(OpenFileCookie* cookie, const struct flock* lock,
|
|||||||
linfo->fType = sGetLockType(lock->l_type, wait);
|
linfo->fType = sGetLockType(lock->l_type, wait);
|
||||||
|
|
||||||
result = NFS4Inode::AcquireLock(cookie, linfo, wait);
|
result = NFS4Inode::AcquireLock(cookie, linfo, wait);
|
||||||
if (result != B_OK)
|
if (result != B_OK) {
|
||||||
|
delete linfo;
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
MutexLocker _(state->fLocksLock);
|
MutexLocker _(state->fLocksLock);
|
||||||
state->AddLock(linfo);
|
state->AddLock(linfo);
|
||||||
|
|||||||
Reference in New Issue
Block a user