Fix a crash

This commit is contained in:
Lauri Kasanen 2015-05-27 16:24:28 +03:00
parent 4402a80630
commit 1e06fbed47
1 changed files with 31 additions and 0 deletions

View File

@ -774,6 +774,36 @@ CheckConnections(void)
}
static void FreeOsBuffers(OsCommPtr oc) {
ConnectionInputPtr oci;
ConnectionOutputPtr oco;
if (AvailableInput == oc)
AvailableInput = (OsCommPtr)NULL;
if ((oci = oc->input)) {
if (FreeInputs) {
free(oci->buffer);
free(oci);
} else {
FreeInputs = oci;
oci->next = (ConnectionInputPtr)NULL;
oci->bufptr = oci->buffer;
oci->bufcnt = 0;
oci->lenLastReq = 0;
}
}
if ((oco = oc->output)) {
if (FreeOutputs) {
free(oco->buf);
free(oco);
} else {
FreeOutputs = oco;
oco->next = (ConnectionOutputPtr)NULL;
oco->count = 0;
}
}
}
/*****************
* CloseDownConnection
* Delete client from AllClients and free resources
@ -790,6 +820,7 @@ CloseDownConnection(ClientPtr client)
XdmcpCloseDisplay(oc->fd);
#endif
CloseDownFileDescriptor(oc);
FreeOsBuffers(oc);
client->osPrivate = (pointer)NULL;
if (auditTrailLevel > 1)
AuditF("client %d disconnected\n", client->index);