summaryrefslogtreecommitdiffstats
path: root/xlators/features/changelog
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 /xlators/features/changelog
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
Diffstat (limited to 'xlators/features/changelog')
-rw-r--r--xlators/features/changelog/src/changelog.c18
1 files changed, 9 insertions, 9 deletions
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);
}