features/locks: Fix Coverity issues

CID:
1395812 Explicit null dereferenced
1356542 Dereference null return value

https://scan6.coverity.com/reports.htm#v42607/p10714/fileInstanceId=86261835&defectInstanceId=26407100&mergedDefectId=1395812
https://scan6.coverity.com/reports.htm#v42607/p10714/fileInstanceId=86261835&defectInstanceId=26407215&mergedDefectId=1356542

Change-Id: I2c20972a8080fa7a70b88eab0688b9cf734bbf24
updates: bz#789278
Signed-off-by: Ashish Pandey <aspandey@redhat.com>
This commit is contained in:
Ashish Pandey 2018-10-11 12:12:38 +05:30 committed by Amar Tumballi
parent b2e592a4a9
commit 09baa5d7fb

View File

@ -755,8 +755,8 @@ truncate_stat_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
gf_boolean_t can_block = _gf_true;
int allowed = 1;
GF_VALIDATE_OR_GOTO("locks", this, unwind);
local = frame->local;
GF_VALIDATE_OR_GOTO("locks", this, unwind);
if (op_ret != 0) {
gf_log(this->name, GF_LOG_ERROR,
@ -854,6 +854,7 @@ unwind:
"truncate failed with "
"ret: %d, error: %s",
op_ret, strerror(op_errno));
if (local->op == GF_FOP_TRUNCATE)
loc_wipe(&local->loc[0]);
if (local->xdata)
@ -2488,6 +2489,8 @@ pl_forget(xlator_t *this, inode_t *inode)
INIT_LIST_HEAD(&entrylks_released);
pl_inode = pl_inode_get(this, inode);
if (!pl_inode)
return 0;
pthread_mutex_lock(&pl_inode->mutex);
{