diff options
author | Soumya Koduri <skoduri@redhat.com> | 2016-02-16 18:50:23 +0530 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2016-02-23 20:15:23 -0800 |
commit | 8cf29a4207c162be8e2993ae36f49090851cbbfc (patch) | |
tree | e01751b76bea964c550e0c53450f98b5304b2058 | |
parent | db747eba347e2909f4fb4fc28a67adb8f188586a (diff) |
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 <skoduri@redhat.com>
Reviewed-on: http://review.gluster.org/13456
Smoke: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
-rw-r--r-- | rpc/rpc-lib/src/rpc-clnt.c | 5 |
1 files changed, 3 insertions, 2 deletions
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); |