nfs4: Fix PVS V595

Move NULL check for 'fReply' and 'fRequest', since they might be NULL.

Change-Id: Icc42b8f24f406d6752c25f4203d6ebe3f6ba0d97
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2168
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
This commit is contained in:
Murai Takashi 2020-01-26 20:37:33 +09:00 committed by Adrien Destugues
parent d38ba84d44
commit 0c481598be
2 changed files with 8 additions and 2 deletions

View File

@ -46,10 +46,13 @@ ReplyBuilder::_InitHeader()
RPC::CallbackReply*
ReplyBuilder::Reply()
{
if (fReply == NULL)
return NULL;
fReply->Stream().InsertUInt(fStatusPosition, _HaikuErrorToNFS4(fStatus));
fReply->Stream().InsertUInt(fOpCountPosition, fOpCount);
if (fReply == NULL || fReply->Stream().Error() == B_OK)
if (fReply->Stream().Error() == B_OK)
return fReply;
else
return NULL;

View File

@ -806,10 +806,13 @@ RequestBuilder::ReleaseLockOwner(OpenState* state, LockOwner* owner)
RPC::Call*
RequestBuilder::Request()
{
if (fRequest == NULL)
return NULL;
if (fProcedure == ProcCompound)
fRequest->Stream().InsertUInt(fOpCountPosition, fOpCount);
if (fRequest == NULL || fRequest->Stream().Error() == B_OK)
if (fRequest->Stream().Error() == B_OK)
return fRequest;
else
return NULL;