mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-11 16:40:17 +00:00
Fixed leak for server creation/destroy
This commit is contained in:
1 parent
9ea7b6f8ae
commit
a741d53028
2 files changed
+6
-2
No files matched your search
@@ -3532,6 +3532,7 @@ unsigned int mg_poll_server(struct mg_server *server, int milliseconds) {
|
||||
}
|
||||
|
||||
void mg_destroy_server(struct mg_server **server) {
|
||||
int i;
|
||||
struct ll *lp, *tmp;
|
||||
|
||||
if (server != NULL && *server != NULL) {
|
||||
@@ -3542,8 +3543,12 @@ void mg_destroy_server(struct mg_server **server) {
|
||||
free(LINKED_LIST_ENTRY(lp, struct connection, link));
|
||||
}
|
||||
LINKED_LIST_FOREACH(&(*server)->uri_handlers, lp, tmp) {
|
||||
free(LINKED_LIST_ENTRY(lp, struct uri_handler, link)->uri);
|
||||
free(LINKED_LIST_ENTRY(lp, struct uri_handler, link));
|
||||
}
|
||||
for (i = 0; i < (int) ARRAY_SIZE((*server)->config_options); i++) {
|
||||
free((*server)->config_options[i]); // It is OK to free(NULL)
|
||||
}
|
||||
#ifdef USE_SSL
|
||||
if ((*server)->ssl_ctx != NULL) SSL_CTX_free((*server)->ssl_ctx);
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user