locks: FORWARD_NULL coverity fix

Problem:
"dst" could be NULL.

Solution:
Added a condition check to avoid NULL pointer dereferencing.

BUG: 789278

Change-Id: I13ccf3234eda50a197f5fdfaf35b247589302582
Signed-off-by: Shwetha Acharya <shwetha174@gmail.com>
This commit is contained in:
Shwetha Acharya 2018-07-30 10:15:34 +05:30 committed by Amar Tumballi
parent bae16c4985
commit 8f437f6c06

View File

@ -529,7 +529,9 @@ __copy_lock(posix_lock_t *src)
GF_FREE(dst);
dst = NULL;
}
INIT_LIST_HEAD (&dst->list);
if (dst != NULL)
INIT_LIST_HEAD (&dst->list);
}
return dst;