summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-lib/src/rpc-transport.c
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2010-09-15 00:27:10 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-15 00:06:37 -0700
commitabf28c8fd12f662f32c1a81f84620f562de8f14b (patch)
treee3d91d68aa1795535b6b7899cb9b31bfc6b2eb4d /rpc/rpc-lib/src/rpc-transport.c
parentcfbbf68f8af83521b41b40c07db48897b976b626 (diff)
memory leak fixes.
- free memory allocated by libc when decoding request arguments in server and reply in client. - free memory allocated to saved_frames during connection cleanup. - free memory allocated for transport name while creating listeners. Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1438 (memory leaks) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1438
Diffstat (limited to 'rpc/rpc-lib/src/rpc-transport.c')
-rw-r--r--rpc/rpc-lib/src/rpc-transport.c14
1 files changed, 10 insertions, 4 deletions
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;