Author: rhuijben
Date: Thu Nov 12 20:17:23 2015
New Revision: 1714111

URL: http://svn.apache.org/viewvc?rev=1714111&view=rev
Log:
In the request cleanup/destroy logic: tweak SERF_DEBUG_BUCKET_USE
code to verify checks while the allocator is still in the right state.

* connection_request.c
  (clean_resp): Check from here, where the allocator is still there...
  (serf__destroy_request): ... instead of here, where the pool containing
    the allocator is already gone.

Modified:
    serf/trunk/connection_request.c

Modified: serf/trunk/connection_request.c
URL: 
http://svn.apache.org/viewvc/serf/trunk/connection_request.c?rev=1714111&r1=1714110&r2=1714111&view=diff
==============================================================================
--- serf/trunk/connection_request.c (original)
+++ serf/trunk/connection_request.c Thu Nov 12 20:17:23 2015
@@ -53,24 +53,34 @@ static apr_status_t clean_resp(void *dat
         serf__connection_pre_cleanup(request->conn);
     }
 
+#ifdef SERF_DEBUG_BUCKET_USE
+    if (respool && request->allocator) {
+        serf_debug__closed_conn(request->allocator);
+    }
+#endif
+
     /* If the response has allocated some buckets, then destroy them (since
        the bucket may hold resources other than memory in RESPOOL). Also
        make sure to set their fields to NULL so connection closure does
        not attempt to free them again.  */
     if (request->resp_bkt) {
-        if (respool)
-            serf_debug__closed_conn(request->resp_bkt->allocator);
         serf_bucket_destroy(request->resp_bkt);
         request->resp_bkt = NULL;
     }
     if (request->req_bkt) {
-        if (respool)
-            serf_debug__closed_conn(request->req_bkt->allocator);
         if (request->writing == SERF_WRITING_NONE)
             serf_bucket_destroy(request->req_bkt);
         request->req_bkt = NULL;
     }
 
+#ifdef SERF_DEBUG_BUCKET_USE
+    if (respool && request->allocator) {
+        serf_debug__bucket_alloc_check(request->allocator);
+    }
+#endif
+
+    request->allocator = NULL;
+
     return APR_SUCCESS;
 }
 
@@ -109,8 +119,6 @@ apr_status_t serf__destroy_request(serf_
 
           apr_pool_cleanup_run(pool, request, clean_resp);
           apr_pool_destroy(pool);
-
-          serf_debug__bucket_alloc_check(request->allocator);
         }
 
         serf_bucket_mem_free(conn->allocator, request);


Reply via email to