1
0
forked from aniani/gmnisrv

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) { if (client->ssl) {
SSL_free(client->ssl); SSL_free(client->ssl);
client->ssl = NULL;
} }
if (client->body) { if (client->body) {
fclose(client->body); fclose(client->body);
client->body = NULL;
} }
close(client->sockfd); close(client->sockfd);
free(client->meta); free(client->meta);
client->meta = NULL;
free(client->path); free(client->path);
client->path = NULL;
size_t index = (client - server->clients) / sizeof(struct gmnisrv_client); size_t index = (client - server->clients) / sizeof(struct gmnisrv_client);
memmove(&server->clients[index], memmove(&server->clients[index],