From f63e4b6e9aada6f96c71513bcf7f501f613a30fe Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Thu, 30 Sep 2010 01:49:52 +0000 Subject: rpc: in rpc_clnt_destroy(), destroy the memory pool also Signed-off-by: Amar Tumballi Signed-off-by: Vijay Bellur BUG: 1727 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1727 --- rpc/rpc-lib/src/rpc-clnt.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'rpc') diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c index 3019daebbcf..61bc5263dc7 100644 --- a/rpc/rpc-lib/src/rpc-clnt.c +++ b/rpc/rpc-lib/src/rpc-clnt.c @@ -1000,6 +1000,8 @@ rpc_clnt_init (struct rpc_clnt_config *config, dict_t *options, ret = rpc_clnt_connection_init (rpc, ctx, options, name); if (ret == -1) { pthread_mutex_destroy (&rpc->lock); + mem_pool_destroy (rpc->reqpool); + mem_pool_destroy (rpc->saved_frames_pool); GF_FREE (rpc); rpc = NULL; if (options) @@ -1457,6 +1459,12 @@ rpc_clnt_destroy (struct rpc_clnt *rpc) saved_frames_destroy (rpc->conn.saved_frames); pthread_mutex_destroy (&rpc->lock); pthread_mutex_destroy (&rpc->conn.lock); + + /* mem-pool should be destroyed, otherwise, + it will cause huge memory leaks */ + mem_pool_destroy (rpc->reqpool); + mem_pool_destroy (rpc->saved_frames_pool); + GF_FREE (rpc); return; } -- cgit