From 10117d2445996b5b7bcff08393bd07639999e32a Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 26 Sep 2011 19:25:25 +0000 Subject: make sure to clean up response ASAP --- src/daemon/daemon.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index 632db289..1c09bbe6 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c @@ -623,9 +623,7 @@ MHD_handle_connection (void *data) if (FD_ISSET (con->socket_fd, &ws)) con->write_handler (con); if (MHD_NO == con->idle_handler (con)) - { - return NULL; - } + goto exit; } #ifdef HAVE_POLL_H else @@ -660,9 +658,7 @@ MHD_handle_connection (void *data) if (0 != (p[0].revents & (POLLERR | POLLHUP))) MHD_connection_close (con, MHD_REQUEST_TERMINATED_WITH_ERROR); if (MHD_NO == con->idle_handler (con)) - { - return NULL; /* "instant" termination, 'con' no longer valid! */ - } + goto exit; } #endif } @@ -678,6 +674,12 @@ MHD_handle_connection (void *data) MHD_connection_close (con, MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN); con->idle_handler (con); } +exit: + if (con->response != NULL) + { + MHD_destroy_response (con->response); + con->response = NULL; + } return NULL; } -- cgit v1.2.3