libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit e264d9ec9ef98e6f26f5f547ec941927a35ffa56
parent 6c991e0929c3fbbdfa0eee099ce52a2fb850da85
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Sun, 14 May 2017 22:30:28 +0300

Fixed response leak when upgrade failed

Diffstat:
Msrc/microhttpd/connection.c | 9+++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -3161,14 +3161,11 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) #ifdef UPGRADE_SUPPORT if (NULL != connection->response->upgrade_handler) { - struct MHD_Response *resp_clr = connection->response; - socket_start_normal_buffering (connection); connection->state = MHD_CONNECTION_UPGRADE; - connection->response = NULL; /* This connection is "upgraded". Pass socket to application. */ if (MHD_YES != - MHD_response_execute_upgrade_ (resp_clr, + MHD_response_execute_upgrade_ (connection->response, connection)) { /* upgrade failed, fail hard */ @@ -3177,8 +3174,8 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) continue; } /* Response is not required anymore for this connection. */ - if (NULL != resp_clr) - MHD_destroy_response (resp_clr); + if (NULL != connection->response) + MHD_destroy_response (connection->response); continue; } #endif /* UPGRADE_SUPPORT */