summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-05-17 18:57:17 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-05-17 18:57:17 -0700
commit92dbad919a7a56c12e87547f05b905530f66dd7b (patch)
tree8b9a99e1d020350b4495ce1aa996c6b877247a27
parentac579e8e3f56f3eadb3426ef97d50f6ab643dc57 (diff)
Avoid double free of client.conn if HandleClientRequest detects disconnect
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/server.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/server.c b/src/server.c
index cc853bf..51bdf91 100644
--- a/src/server.c
+++ b/src/server.c
@@ -494,6 +494,7 @@ HandleClientRequest(client_state *client, xhiv_response *responses)
if ((rbytes == 0) && (errno == 0)) {
/* client disconnected */
_XSERVTransClose(client->conn);
+ client->conn = NULL;
return;
}
if (rbytes <= 0) {
@@ -728,7 +729,8 @@ XhivRunServer(XtransConnInfo *ListenTransConns, int ListenTransCount,
else
clientfd.events = POLLIN | POLLOUT;
}
- _XSERVTransClose(client.conn);
+ if (client.conn != NULL)
+ _XSERVTransClose(client.conn);
exit(0);
}