1
0
mirror of https://git.sr.ht/~sircmpwn/gmnisrv synced 2024-11-03 06:07:17 -05:00

Prevent double free of client resources

This commit is contained in:
Drew DeVault 2020-11-08 16:37:53 -05:00
parent ea2914efff
commit 74077b6f95

View File

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