commit 10117d2445996b5b7bcff08393bd07639999e32a
parent 7c9073a4c961a23cfaadc2666ffba774c727a847
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 26 Sep 2011 19:25:25 +0000
make sure to clean up response ASAP
Diffstat:
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git 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;
}