summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--glusterfsd/src/glusterfsd.c5
-rw-r--r--xlators/protocol/server/src/server.c9
2 files changed, 10 insertions, 4 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index 81a73344d6b..c3fea207b6e 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -1642,6 +1642,9 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx)
struct rlimit lim = {0, };
int ret = -1;
+ if (!ctx)
+ return ret;
+
ret = xlator_mem_acct_init (THIS, gfd_mt_end);
if (ret != 0) {
gf_msg(THIS->name, GF_LOG_CRITICAL, 0, glusterfsd_msg_34,
@@ -1774,7 +1777,7 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx)
ret = 0;
out:
- if (ret && ctx) {
+ if (ret) {
if (ctx->pool) {
mem_pool_destroy (ctx->pool->frame_mem_pool);
mem_pool_destroy (ctx->pool->stack_mem_pool);
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index 73d239f0fb3..4cf4b4aeac1 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -970,7 +970,6 @@ server_init (xlator_t *this)
{
int32_t ret = -1;
server_conf_t *conf = NULL;
- rpcsvc_listener_t *listener = NULL;
char *transport_type = NULL;
char *statedump_path = NULL;
int total_transport = 0;
@@ -1229,8 +1228,12 @@ out:
this->fini (this);
}
- if (listener != NULL) {
- rpcsvc_listener_destroy (listener);
+ if (conf && conf->rpc) {
+ rpcsvc_listener_t *listener, *next;
+ list_for_each_entry_safe (listener, next,
+ &conf->rpc->listeners, list) {
+ rpcsvc_listener_destroy (listener);
+ }
}
}