summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-09-15 04:53:34 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-15 03:38:34 -0700
commit7618628ff3c469af38d9c58840e5d0c8fde7156a (patch)
treed71857b4b442b1c8ef32a065af4682af48611d5f
parent3d1a0c2e3787f1c1b6cb1eb45690f36e175e983b (diff)
rpc-transport.c: handle a double free
* 'this->name' was getting freed in '(transport)->fini()'. Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1605 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1605
-rw-r--r--rpc/rpc-lib/src/rpc-transport.c6
-rw-r--r--rpc/rpc-transport/socket/src/socket.c3
2 files changed, 5 insertions, 4 deletions
diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c
index 29f02811f..39256d242 100644
--- a/rpc/rpc-lib/src/rpc-transport.c
+++ b/rpc/rpc-lib/src/rpc-transport.c
@@ -1063,8 +1063,12 @@ rpc_transport_destroy (rpc_transport_t *this)
if (this->fini)
this->fini (this);
+
pthread_mutex_destroy (&this->lock);
- GF_FREE (this->name);
+
+ if (this->name)
+ GF_FREE (this->name);
+
GF_FREE (this);
fail:
return ret;
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index 1d6ebc803..ca3505d73 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -2484,9 +2484,6 @@ fini (rpc_transport_t *this)
GF_FREE (priv);
}
- if (this->name)
- GF_FREE (this->name);
-
this->private = NULL;
}