httpd-apreq-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r125035 - /httpd/apreq/trunk/t/parsers.c /httpd/apreq/trunk/t/testall.c
Date Thu, 13 Jan 2005 04:31:43 GMT
Author: joes
Date: Wed Jan 12 20:31:42 2005
New Revision: 125035

URL: http://svn.apache.org/viewcvs?view=rev&rev=125035
Log:
Created bucket allocators require explicit
destructor calls, otherwise they leak ~ 8K per instance.
This bug only impacts the cgi and test environments.
For detailed discussion see

   http://marc.theaimsgroup.com/?t=110557054800001&r=1&w=2


Modified:
   httpd/apreq/trunk/t/parsers.c
   httpd/apreq/trunk/t/testall.c

Modified: httpd/apreq/trunk/t/parsers.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/trunk/t/parsers.c?view=diff&rev=125035&p1=httpd/apreq/trunk/t/parsers.c&r1=125034&p2=httpd/apreq/trunk/t/parsers.c&r2=125035
==============================================================================
--- httpd/apreq/trunk/t/parsers.c	(original)
+++ httpd/apreq/trunk/t/parsers.c	Wed Jan 12 20:31:42 2005
@@ -176,6 +176,7 @@
 {
     apr_status_t rv;
     apr_size_t i, j;
+    apr_bucket_alloc_t *ba;
 
     for (j = 0; j <= strlen(form_data); ++j) {
         const char *enctype;
@@ -189,7 +190,8 @@
         enctype = apreq_enctype(req->env);
         CuAssertStrEquals(tc, APREQ_MFD_ENCTYPE, enctype);
 
-        bb = apr_brigade_create(p, apr_bucket_alloc_create(p));
+        ba = apr_bucket_alloc_create(p);
+        bb = apr_brigade_create(p, ba);
 
         for (i = 0; i <= strlen(form_data); ++i) {
             const char *val;
@@ -241,10 +243,11 @@
             CuAssertStrEquals(tc, "text/plain", val);
             apr_brigade_cleanup(bb);
         }
-
+        apr_bucket_alloc_destroy(ba);
         apr_pool_clear(p);
     }
 }
+
 static void parse_disable_uploads(CuTest *tc)
 {
     const char *val;

Modified: httpd/apreq/trunk/t/testall.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/trunk/t/testall.c?view=diff&rev=125035&p1=httpd/apreq/trunk/t/testall.c&r1=125034&p2=httpd/apreq/trunk/t/testall.c&r2=125035
==============================================================================
--- httpd/apreq/trunk/t/testall.c	(original)
+++ httpd/apreq/trunk/t/testall.c	Wed Jan 12 20:31:42 2005
@@ -66,9 +66,18 @@
     return p;
 }
 
+static apr_status_t bucket_alloc_cleanup(void *data)
+{
+    apr_bucket_alloc_t *ba = data;
+    apr_bucket_alloc_destroy(ba);
+    return APR_SUCCESS;
+}
+
 static apr_bucket_alloc_t *test_bucket_alloc(void *env)
 {
-    return apr_bucket_alloc_create(p);
+    apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p);
+    apr_pool_cleanup_register(p, ba, bucket_alloc_cleanup, NULL);
+    return ba;
 }
 
 static const char *test_header_in(void *env, const char *name)

Mime
View raw message