1
0
forked from aniani/gmnisrv

disconnect_client: free more client resources

This commit is contained in:
Drew DeVault 2020-09-26 15:53:37 -04:00
parent 6bc9c4deb9
commit e9641dbf1e

View File

@ -188,8 +188,15 @@ disconnect_client(struct gmnisrv_server *server, struct gmnisrv_client *client)
if (client->bio) {
BIO_free_all(client->bio);
}
if (client->ssl) {
SSL_free(client->ssl);
}
if (client->body) {
fclose(client->body);
}
close(client->sockfd);
free(client->meta);
free(client->path);
size_t index = (client - server->clients) / sizeof(struct gmnisrv_client);
memmove(client, &client[1], &server->clients[server->clientsz] - client);