From 8f437f6c06587c3465764d1ec4b7f81d60a94eae Mon Sep 17 00:00:00 2001 From: Shwetha Acharya Date: Mon, 30 Jul 2018 10:15:34 +0530 Subject: 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 --- xlators/features/locks/src/common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'xlators/features/locks/src/common.c') diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c index 0fba36cc088..324187a4a7a 100644 --- a/xlators/features/locks/src/common.c +++ b/xlators/features/locks/src/common.c @@ -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; -- cgit