summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rpc/rpc-transport/socket/src/socket.c15
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c8
2 files changed, 22 insertions, 1 deletions
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index 490fe8a7e98..e3d97f7c839 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -2491,8 +2491,10 @@ socket_server_event_handler (int fd, int idx, void *data,
new_trans = GF_CALLOC (1, sizeof (*new_trans),
gf_common_mt_rpc_trans_t);
- if (!new_trans)
+ if (!new_trans) {
+ close (new_sock);
goto unlock;
+ }
ret = pthread_mutex_init(&new_trans->lock, NULL);
if (ret == -1) {
@@ -2500,6 +2502,7 @@ socket_server_event_handler (int fd, int idx, void *data,
"pthread_mutex_init() failed: %s",
strerror (errno));
close (new_sock);
+ GF_FREE (new_trans);
goto unlock;
}
@@ -2520,6 +2523,8 @@ socket_server_event_handler (int fd, int idx, void *data,
"getsockname on %d failed (%s)",
new_sock, strerror (errno));
close (new_sock);
+ GF_FREE (new_trans->name);
+ GF_FREE (new_trans);
goto unlock;
}
@@ -2527,6 +2532,8 @@ socket_server_event_handler (int fd, int idx, void *data,
ret = socket_init(new_trans);
if (ret != 0) {
close(new_sock);
+ GF_FREE (new_trans->name);
+ GF_FREE (new_trans);
goto unlock;
}
new_trans->ops = this->ops;
@@ -2549,6 +2556,8 @@ socket_server_event_handler (int fd, int idx, void *data,
gf_log(this->name,GF_LOG_ERROR,
"server setup failed");
close(new_sock);
+ GF_FREE (new_trans->name);
+ GF_FREE (new_trans);
goto unlock;
}
}
@@ -2562,6 +2571,8 @@ socket_server_event_handler (int fd, int idx, void *data,
new_sock, strerror (errno));
close (new_sock);
+ GF_FREE (new_trans->name);
+ GF_FREE (new_trans);
goto unlock;
}
}
@@ -2600,6 +2611,8 @@ socket_server_event_handler (int fd, int idx, void *data,
if (ret == -1) {
gf_log (this->name, GF_LOG_WARNING,
"failed to register the socket with event");
+ close (new_sock);
+ rpc_transport_unref (new_trans);
goto unlock;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index 9da8a29902c..831cb82b28d 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -937,6 +937,14 @@ _install_mount_spec (dict_t *opts, char *key, data_t *value, void *data)
"adding %smount spec failed: label: %s desc: %s",
georep ? GEOREP" " : "", label, pdesc);
+ if (mspec) {
+ if (mspec->patterns) {
+ GF_FREE (mspec->patterns->components);
+ GF_FREE (mspec->patterns);
+ }
+ GF_FREE (mspec);
+ }
+
return -1;
}