From 14aedbab7f07b581510677f7f036be5b35b39ff2 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Sat, 5 Jul 2014 12:19:28 +0530 Subject: client_t: Fix memory leaks Backport of http://review.gluster.org/8247 - Assign frame->root->client so that gf_client_unref happens in server_connection_cleanup_flush_cbk - Avoid taking extra ref in gf_client_get TODO: The whole reason why there are two types of refs bind, ref-count is to avoid lock inside lock which is not the case now. I will be sending one more patch which will accomplish that as well as changing the tablearray to list BUG: 1116672 Change-Id: Ica87b9cbf02cae34c10789cfb56d1ccdc393cbf0 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/8289 Tested-by: Gluster Build System Reviewed-by: Niels de Vos --- xlators/protocol/server/src/server-helpers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'xlators/protocol/server/src/server-helpers.c') diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c index a7e171c5537..37752394ec8 100644 --- a/xlators/protocol/server/src/server-helpers.c +++ b/xlators/protocol/server/src/server-helpers.c @@ -241,7 +241,6 @@ server_connection_cleanup_flush_cbk (call_frame_t *frame, void *cookie, client_t *client = NULL; GF_VALIDATE_OR_GOTO ("server", this, out); - GF_VALIDATE_OR_GOTO ("server", cookie, out); GF_VALIDATE_OR_GOTO ("server", frame, out); fd = frame->local; @@ -297,9 +296,9 @@ do_fd_cleanup (xlator_t *this, client_t* client, fdentry_t *fdentries, int fd_co } tmp_frame->local = fd; - tmp_frame->root->pid = 0; gf_client_ref (client); + tmp_frame->root->client = client; memset (&tmp_frame->root->lk_owner, 0, sizeof (gf_lkowner_t)); @@ -1042,6 +1041,7 @@ server_ctx_get (client_t *client, xlator_t *xlator) if (client_ctx_set (client, xlator, ctx) != 0) { LOCK_DESTROY (&ctx->fdtable_lock); + GF_FREE (ctx->fdtable); GF_FREE (ctx); ctx = NULL; } -- cgit