summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshish Pandey <aspandey@redhat.com>2020-04-28 11:31:17 +0530
committerMOHIT AGRAWAL <moagrawa@redhat.com>2020-05-26 03:03:18 +0000
commit61c4695ea1411feeea7a802c37446bc0df45e31c (patch)
treed29aa0e1dbdafcb3a24027ca8200387aec619743
parent177cc09d24515596eb51739ce0a276c26e3c52f1 (diff)
afr/changelog: fix NULL dereferences and error handling
This patch includes the following CID from Coverity Scan: *1419116 *1420206 Change-Id: Id92fd6a78c8a00726a61aa4697b5c126ced8ed4d Updates: #1202
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-common.c3
-rw-r--r--xlators/features/changelog/src/changelog.c18
2 files changed, 11 insertions, 10 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
index fdec66340ba..998e9045b97 100644
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
@@ -1909,7 +1909,8 @@ afr_selfheal_unlocked_discover(call_frame_t *frame, inode_t *inode, uuid_t gfid,
dict_t *dict = NULL;
local = frame->local;
- if (local && local->xattr_req)
+
+ if (local->xattr_req)
dict = local->xattr_req;
return afr_selfheal_unlocked_discover_on(frame, inode, gfid, replies,
diff --git a/xlators/features/changelog/src/changelog.c b/xlators/features/changelog/src/changelog.c
index 37916f40882..9a7d158cbf2 100644
--- a/xlators/features/changelog/src/changelog.c
+++ b/xlators/features/changelog/src/changelog.c
@@ -2036,20 +2036,20 @@ notify(xlator_t *this, int event, void *data, ...)
priv->notify_down = _gf_true;
}
UNLOCK(&priv->lock);
- list_for_each_entry_safe(listener, next, &priv->rpc->listeners,
- list)
- {
- if (listener->trans) {
- rpc_transport_unref(listener->trans);
+ if (priv->rpc) {
+ list_for_each_entry_safe(listener, next,
+ &priv->rpc->listeners, list)
+ {
+ if (listener->trans) {
+ rpc_transport_unref(listener->trans);
+ }
}
+ rpcsvc_destroy(priv->rpc);
+ priv->rpc = NULL;
}
CHANGELOG_MAKE_SOCKET_PATH(priv->changelog_brick, sockfile,
UNIX_PATH_MAX);
sys_unlink(sockfile);
- if (priv->rpc) {
- rpcsvc_destroy(priv->rpc);
- priv->rpc = NULL;
- }
if (!cleanup_notify)
default_notify(this, GF_EVENT_PARENT_DOWN, data);
}