Index: connection.c =================================================================== --- connection.c (revision 16953) +++ connection.c (working copy) @@ -311,11 +311,6 @@ &connection->client_context, termination_code); connection->client_aware = MHD_NO; - if (connection->response != NULL) - { - MHD_destroy_response (connection->response); - connection->response = NULL; - } } @@ -2291,6 +2286,11 @@ } continue; case MHD_CONNECTION_CLOSED: + if (connection->response != NULL) + { + MHD_destroy_response (connection->response); + connection->response = NULL; + } daemon = connection->daemon; if (0 != pthread_mutex_lock(&daemon->cleanup_connection_mutex)) {