From 8cf29a4207c162be8e2993ae36f49090851cbbfc Mon Sep 17 00:00:00 2001 From: Soumya Koduri Date: Tue, 16 Feb 2016 18:50:23 +0530 Subject: rpc: Fix for rpc_transport_t leak The transport object needs to get unref'ed when the rpc clnt object is getting destroyed. But currently in rpc_clnt_disable() we set conn->trans to NULL before it gets unref'ed leading to transport object leak. This change is to fix it by setting conn-tran to NULL only when it is being unref'ed. Change-Id: I79ba34e28ae19eb616035f36bbed1c2f47875b94 BUG: 1295107 Signed-off-by: Soumya Koduri Reviewed-on: http://review.gluster.org/13456 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Kaleb KEITHLEY Reviewed-by: Jeff Darcy --- rpc/rpc-lib/src/rpc-clnt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'rpc') diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c index c57c38d3117..5513b6db046 100644 --- a/rpc/rpc-lib/src/rpc-clnt.c +++ b/rpc/rpc-lib/src/rpc-clnt.c @@ -1645,8 +1645,10 @@ rpc_clnt_trigger_destroy (struct rpc_clnt *rpc) /* This is to account for rpc_clnt_disable that might have been called * before rpc_clnt_unref */ - if (trans) + if (trans) { rpc_transport_unref (trans); + conn->trans = NULL; + } } static void @@ -1741,7 +1743,6 @@ rpc_clnt_disable (struct rpc_clnt *rpc) unref = rpc_clnt_remove_ping_timer_locked (rpc); trans = conn->trans; - conn->trans = NULL; } pthread_mutex_unlock (&conn->lock); -- cgit