summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks/src
diff options
context:
space:
mode:
authorShwetha Acharya <shwetha174@gmail.com>2018-07-30 10:15:34 +0530
committerAmar Tumballi <amarts@redhat.com>2018-08-17 07:34:59 +0000
commit8f437f6c06587c3465764d1ec4b7f81d60a94eae (patch)
treea246071ddf5d56fbd18899db560091d7f26b8aea /xlators/features/locks/src
parentbae16c498599d4bf1dddca03bf56fa53c73d251a (diff)
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>
Diffstat (limited to 'xlators/features/locks/src')
-rw-r--r--xlators/features/locks/src/common.c4
1 files changed, 3 insertions, 1 deletions
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;