summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c1
-rw-r--r--rpc/rpc-lib/src/rpc-transport.c14
-rw-r--r--rpc/rpc-lib/src/rpcsvc.c3
-rw-r--r--xlators/protocol/client/src/client-handshake.c1
-rw-r--r--xlators/protocol/server/src/server-handshake.c18
-rw-r--r--xlators/protocol/server/src/server3_1-fops.c49
6 files changed, 78 insertions, 8 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index 79be1acaea8..de4087ad52b 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -1394,6 +1394,7 @@ rpc_clnt_destroy (struct rpc_clnt *rpc)
rpc_transport_destroy (rpc->conn.trans);
rpc_clnt_connection_cleanup (&rpc->conn);
rpc_clnt_reconnect_cleanup (&rpc->conn);
+ saved_frames_destroy (rpc->conn.saved_frames);
pthread_mutex_destroy (&rpc->lock);
pthread_mutex_destroy (&rpc->conn.lock);
GF_FREE (rpc);
diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c
index 7acf04d027c..29f02811fdd 100644
--- a/rpc/rpc-lib/src/rpc-transport.c
+++ b/rpc/rpc-lib/src/rpc-transport.c
@@ -902,10 +902,6 @@ rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *trans_name)
goto fail;
}
- if (name) {
- GF_FREE (name);
- }
-
trans->ops = dlsym (handle, "tops");
if (trans->ops == NULL) {
gf_log ("rpc-transport", GF_LOG_ERROR,
@@ -962,6 +958,11 @@ rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *trans_name)
pthread_mutex_init (&trans->lock, NULL);
trans->xl = THIS;
return_trans = trans;
+
+ if (name) {
+ GF_FREE (name);
+ }
+
GF_FREE (vol_opt);
return return_trans;
@@ -978,6 +979,10 @@ fail:
GF_FREE (vol_opt);
}
+ if (name) {
+ GF_FREE (name);
+ }
+
return NULL;
}
@@ -1059,6 +1064,7 @@ rpc_transport_destroy (rpc_transport_t *this)
if (this->fini)
this->fini (this);
pthread_mutex_destroy (&this->lock);
+ GF_FREE (this->name);
GF_FREE (this);
fail:
return ret;
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
index 5f6f6b31053..030e23db74d 100644
--- a/rpc/rpc-lib/src/rpcsvc.c
+++ b/rpc/rpc-lib/src/rpcsvc.c
@@ -1902,7 +1902,7 @@ rpcsvc_create_listeners (rpcsvc_t *svc, dict_t *options, char *name)
goto out;
}
- ret = asprintf (&transport_name, "%s.%s", tmp, name);
+ ret = gf_asprintf (&transport_name, "%s.%s", tmp, name);
if (ret == -1) {
goto out;
}
@@ -1920,6 +1920,7 @@ rpcsvc_create_listeners (rpcsvc_t *svc, dict_t *options, char *name)
goto out;
}
+ GF_FREE (transport_name);
count++;
}
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index d94cb774c87..48f19861b0e 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -837,6 +837,7 @@ out:
trav = rsp.prog;
while (trav) {
next = trav->next;
+ free (trav->progname);
free (trav);
trav = next;
}
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
index 98ec18cc2e9..b148f06690d 100644
--- a/xlators/protocol/server/src/server-handshake.c
+++ b/xlators/protocol/server/src/server-handshake.c
@@ -355,6 +355,7 @@ server_setvolume (rpcsvc_request_t *req)
int32_t op_errno = EINVAL;
int32_t fop_version = 0;
int32_t mgmt_version = 0;
+ char *buf = NULL;
params = dict_new ();
reply = dict_new ();
@@ -369,7 +370,15 @@ server_setvolume (rpcsvc_request_t *req)
config_params = dict_copy_with_ref (this->options, NULL);
conf = this->private;
- ret = dict_unserialize (args.dict.dict_val, args.dict.dict_len, &params);
+ buf = memdup (args.dict.dict_val, args.dict.dict_len);
+ if (buf == NULL) {
+ gf_log (this->name, GF_LOG_ERROR, "out of memory");
+ op_ret = -1;
+ op_errno = ENOMEM;
+ goto fail;
+ }
+
+ ret = dict_unserialize (buf, args.dict.dict_len, &params);
if (ret < 0) {
ret = dict_set_str (reply, "ERROR",
"Internal error: failed to unserialize "
@@ -385,6 +394,9 @@ server_setvolume (rpcsvc_request_t *req)
goto fail;
}
+ params->extra_free = buf;
+ buf = NULL;
+
ret = dict_get_str (params, "process-uuid", &process_uuid);
if (ret < 0) {
ret = dict_set_str (reply, "ERROR",
@@ -622,6 +634,10 @@ fail:
dict_unref (reply);
dict_unref (config_params);
+ if (buf) {
+ GF_FREE (buf);
+ }
+
return 0;
}
diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c
index 5be50475719..1ced00a4bc2 100644
--- a/xlators/protocol/server/src/server3_1-fops.c
+++ b/xlators/protocol/server/src/server3_1-fops.c
@@ -2904,6 +2904,12 @@ server_create (rpcsvc_request_t *req)
memcpy (state->resolve.pargfid, args.pargfid, 16);
resolve_and_resume (frame, server_create_resume);
+
+ /* memory allocated by libc, don't use GF_FREE */
+ if (args.dict.dict_val != NULL) {
+ free (args.dict.dict_val);
+ }
+
return 0;
out:
if (params)
@@ -2912,8 +2918,13 @@ out:
if (buf) {
GF_FREE (buf);
}
- return 0;
+ /* memory allocated by libc, don't use GF_FREE */
+ if (args.dict.dict_val != NULL) {
+ free (args.dict.dict_val);
+ }
+
+ return 0;
}
@@ -4109,6 +4120,12 @@ server_mknod (rpcsvc_request_t *req)
state->dev = args.dev;
resolve_and_resume (frame, server_mknod_resume);
+
+ /* memory allocated by libc, don't use GF_FREE */
+ if (args.dict.dict_val != NULL) {
+ free (args.dict.dict_val);
+ }
+
return 0;
out:
if (params)
@@ -4117,6 +4134,12 @@ out:
if (buf) {
GF_FREE (buf);
}
+
+ /* memory allocated by libc, don't use GF_FREE */
+ if (args.dict.dict_val != NULL) {
+ free (args.dict.dict_val);
+ }
+
return 0;
}
@@ -4197,6 +4220,12 @@ server_mkdir (rpcsvc_request_t *req)
state->mode = args.mode;
resolve_and_resume (frame, server_mkdir_resume);
+
+ if (args.dict.dict_val != NULL) {
+ /* memory allocated by libc, don't use GF_FREE */
+ free (args.dict.dict_val);
+ }
+
return 0;
out:
if (params)
@@ -4205,8 +4234,13 @@ out:
if (buf) {
GF_FREE (buf);
}
- return 0;
+ if (args.dict.dict_val != NULL) {
+ /* memory allocated by libc, don't use GF_FREE */
+ free (args.dict.dict_val);
+ }
+
+ return 0;
}
@@ -4631,6 +4665,11 @@ server_symlink (rpcsvc_request_t *req)
state->name = gf_strdup (args.linkname);
resolve_and_resume (frame, server_symlink_resume);
+
+ /* memory allocated by libc, don't use GF_FREE */
+ if (args.dict.dict_val != NULL) {
+ free (args.dict.dict_val);
+ }
return 0;
out:
if (params)
@@ -4639,6 +4678,12 @@ out:
if (buf) {
GF_FREE (buf);
}
+
+ /* memory allocated by libc, don't use GF_FREE */
+ if (args.dict.dict_val != NULL) {
+ free (args.dict.dict_val);
+ }
+
return 0;
}