mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-21 19:51:50 +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
+1
-2
@@ -361,8 +361,7 @@ unless (scalar(@ARGV) > 0 and $ARGV[0] eq "basic_tests") {
|
|||||||
o("GET /dir%20with%20spaces/hello.cgi HTTP/1.0\n\r\n",
|
o("GET /dir%20with%20spaces/hello.cgi HTTP/1.0\n\r\n",
|
||||||
'HTTP/1.1 200 OK.+hello', 'CGI script with spaces in path');
|
'HTTP/1.1 200 OK.+hello', 'CGI script with spaces in path');
|
||||||
o("GET /env.cgi HTTP/1.0\n\r\n", 'HTTP/1.1 200 OK', 'GET CGI file');
|
o("GET /env.cgi HTTP/1.0\n\r\n", 'HTTP/1.1 200 OK', 'GET CGI file');
|
||||||
o("GET /bad2.cgi HTTP/1.0\n\n", "HTTP/1.1 302 Please pass me to the client\r",
|
o("GET /bad2.cgi HTTP/1.0\n\n", "^HTTP/1.1 302", 'CGI Status code');
|
||||||
'CGI Status code text');
|
|
||||||
o("GET /sh.cgi HTTP/1.0\n\r\n", 'shell script CGI',
|
o("GET /sh.cgi HTTP/1.0\n\r\n", 'shell script CGI',
|
||||||
'GET sh CGI file') unless on_windows();
|
'GET sh CGI file') unless on_windows();
|
||||||
o("GET /env.cgi?var=HELLO HTTP/1.0\n\n", 'QUERY_STRING=var=HELLO',
|
o("GET /env.cgi?var=HELLO HTTP/1.0\n\n", 'QUERY_STRING=var=HELLO',
|
||||||
|
|||||||
@@ -3532,6 +3532,7 @@ unsigned int mg_poll_server(struct mg_server *server, int milliseconds) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void mg_destroy_server(struct mg_server **server) {
|
void mg_destroy_server(struct mg_server **server) {
|
||||||
|
int i;
|
||||||
struct ll *lp, *tmp;
|
struct ll *lp, *tmp;
|
||||||
|
|
||||||
if (server != NULL && *server != NULL) {
|
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));
|
free(LINKED_LIST_ENTRY(lp, struct connection, link));
|
||||||
}
|
}
|
||||||
LINKED_LIST_FOREACH(&(*server)->uri_handlers, lp, tmp) {
|
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));
|
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
|
#ifdef USE_SSL
|
||||||
if ((*server)->ssl_ctx != NULL) SSL_CTX_free((*server)->ssl_ctx);
|
if ((*server)->ssl_ctx != NULL) SSL_CTX_free((*server)->ssl_ctx);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in new issue
Block a user