summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorMohit Agrawal <moagrawa@redhat.com>2016-07-15 14:12:31 +0530
committerRaghavendra G <rgowdapp@redhat.com>2016-07-20 05:37:39 -0700
commitd724a87e682cf14a3f2a85888cad5c5db203fb5b (patch)
tree045a23f5a39583646c9f3ab93782d53a2cb62b5c /rpc
parent1f97d7101b3313ce647638310e1028da8dac6785 (diff)
rpc/socket.c : Modify socket code to avoid fd leak in case of socket_poller thread
Update socket code to avoid fd leak in case of socket_poller thread. Change-Id: Ifa9718fbaf065988a299cda7ba0282dfd6b10a32 BUG: 1356888 Signed-off-by: Mohit Agrawal <moagrawa@redhat.com> Reviewed-on: http://review.gluster.org/14929 CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-transport/socket/src/socket.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index 3aae10bd501..af496ffc8e2 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -2786,8 +2786,6 @@ socket_server_event_handler (int fd, int idx, void *data,
pthread_mutex_unlock (&new_priv->lock);
if (ret == -1) {
sys_close (new_sock);
- GF_FREE (new_trans->name);
- GF_FREE (new_trans);
rpc_transport_unref (new_trans);
goto unlock;
}
@@ -3108,8 +3106,9 @@ handler:
if (ret) {
gf_log(this->name, GF_LOG_ERROR,
"could not spawn thread");
- sys_close(priv->pipe[0]);
- sys_close(priv->pipe[1]);
+ sys_close (priv->pipe[0]);
+ sys_close (priv->pipe[1]);
+ sys_close (priv->sock);
priv->sock = -1;
}
}