Author: rhuijben Date: Thu Nov 5 00:29:38 2015 New Revision: 1712694 URL: http://svn.apache.org/viewvc?rev=1712694&view=rev Log: Combine a bit of cleanup code for explicit cleanup and that via the cleanup pools.
* connection_request.c (clean_resp): Introduce a bit of cleanup code here. (serf__destroy_request): And explicitly call it from here, which now doesn't have to do that itself. Modified: serf/trunk/connection_request.c Modified: serf/trunk/connection_request.c URL: http://svn.apache.org/viewvc/serf/trunk/connection_request.c?rev=1712694&r1=1712693&r2=1712694&view=diff ============================================================================== --- serf/trunk/connection_request.c (original) +++ serf/trunk/connection_request.c Thu Nov 5 00:29:38 2015 @@ -40,10 +40,14 @@ static apr_status_t clean_resp(void *dat make sure to set their fields to NULL so connection closure does not attempt to free them again. */ if (request->resp_bkt) { + if (request->respool) + serf_debug__closed_conn(request->resp_bkt->allocator); serf_bucket_destroy(request->resp_bkt); request->resp_bkt = NULL; } if (request->req_bkt) { + if (request->respool) + serf_debug__closed_conn(request->req_bkt->allocator); if (!request->writing_started) serf_bucket_destroy(request->req_bkt); request->req_bkt = NULL; @@ -77,26 +81,13 @@ apr_status_t serf__destroy_request(serf_ { serf_connection_t *conn = request->conn; - /* The request and response buckets are no longer needed, - nor is the request's pool. */ - if (request->resp_bkt) { - serf_debug__closed_conn(request->resp_bkt->allocator); - serf_bucket_destroy(request->resp_bkt); - request->resp_bkt = NULL; - } - if (request->req_bkt) { - serf_debug__closed_conn(request->req_bkt->allocator); + if (request->respool) { + apr_pool_t *pool = request->respool; - if (!request->writing_started) - serf_bucket_destroy(request->req_bkt); - request->req_bkt = NULL; - } + apr_pool_cleanup_run(pool, request, clean_resp); + apr_pool_destroy(pool); - if (request->respool) { serf_debug__bucket_alloc_check(request->allocator); - - /* ### unregister the pool cleanup for self? */ - apr_pool_destroy(request->respool); } serf_bucket_mem_free(conn->allocator, request);