summaryrefslogtreecommitdiff
path: root/include/apr_buckets.h
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2010-06-05 20:43:15 +0000
committerJoe Orton <jorton@apache.org>2010-06-05 20:43:15 +0000
commit52cd520bb5902319edc552c2a1185cc50091d704 (patch)
tree119726a0796e2eea79ed36735e0e1b20a346be3e /include/apr_buckets.h
parent2eecee3d1cbbee9964002a24a45913900906c03d (diff)
downloadapr-52cd520bb5902319edc552c2a1185cc50091d704.tar.gz
Add debugging traps for use-after-destroy of a brigade:
* buckets/apr_brigade.c (apr_brigade_cleanup): Check brigade consistency. (apr_brigade_destroy) [APR_BUCKET_DEBUG]: Check brigade consistency before destroying it, and clear b->p, b->bucket_alloc after. * include/apr_buckets.h (APR_BRIGADE_CHECK_CONSISTENCY): assert that b->p and b->bucket_alloc are non-NULL. Suggested by: sf git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@951762 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include/apr_buckets.h')
-rw-r--r--include/apr_buckets.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/apr_buckets.h b/include/apr_buckets.h
index c900934e7..18453ce79 100644
--- a/include/apr_buckets.h
+++ b/include/apr_buckets.h
@@ -288,8 +288,11 @@ typedef apr_status_t (*apr_brigade_flush)(apr_bucket_brigade *bb, void *ctx);
*/
#ifdef APR_BUCKET_DEBUG
-#define APR_BRIGADE_CHECK_CONSISTENCY(b) \
- APR_RING_CHECK_CONSISTENCY(&(b)->list, apr_bucket, link)
+#define APR_BRIGADE_CHECK_CONSISTENCY(b) do { \
+ APR_RING_CHECK_CONSISTENCY(&(b)->list, apr_bucket, link); \
+ assert(b->p != NULL); \
+ assert(b->bucket_alloc != NULL); \
+} while (0)
#define APR_BUCKET_CHECK_CONSISTENCY(e) \
APR_RING_CHECK_ELEM_CONSISTENCY((e), apr_bucket, link)