httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <jwool...@virginia.edu>
Subject Re: huge memory leak in 2.0.x
Date Tue, 15 Jun 2004 19:14:53 GMT
On Tue, 15 Jun 2004, Joe Orton wrote:

> 2) allocate brigade structures using the bucket allocator

If you're going to do this, then surely you need to call
apr_pool_cleanup_register() somewhere?


===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_brigade.c,v
retrieving revision 1.60
diff -u -r1.60 apr_brigade.c
--- buckets/apr_brigade.c       13 Feb 2004 09:55:25 -0000      1.60
+++ buckets/apr_brigade.c       15 Jun 2004 15:34:47 -0000
@@ -30,7 +30,9 @@

 static apr_status_t brigade_cleanup(void *data)
 {
-    return apr_brigade_cleanup(data);
+    apr_status_t rv = apr_brigade_cleanup(data);
+    apr_bucket_free(data);
+    return rv;
 }

 APU_DECLARE(apr_status_t) apr_brigade_cleanup(void *data)
@@ -42,14 +44,12 @@
         e = APR_BRIGADE_FIRST(b);
         apr_bucket_delete(e);
     }
-    /* We don't need to free(bb) because it's allocated from a pool. */
     return APR_SUCCESS;
 }

 APU_DECLARE(apr_status_t) apr_brigade_destroy(apr_bucket_brigade *b)
 {
-    apr_pool_cleanup_kill(b->p, b, brigade_cleanup);
-    return apr_brigade_cleanup(b);
+    return apr_pool_cleanup_run(b->p, b, brigade_cleanup);
 }

 APU_DECLARE(apr_bucket_brigade *) apr_brigade_create(apr_pool_t *p,
@@ -57,7 +57,7 @@
 {
     apr_bucket_brigade *b;

-    b = apr_palloc(p, sizeof(*b));
+    b = apr_bucket_alloc(sizeof *b, list);
     b->p = p;
     b->bucket_alloc = list;



Mime
View raw message