]> granicus.if.org Git - apache/commitdiff
* modules/filters/mod_deflate.c (deflate_out_filter): Destroy buckets
authorJoe Orton <jorton@apache.org>
Tue, 1 Jun 2004 13:06:10 +0000 (13:06 +0000)
committerJoe Orton <jorton@apache.org>
Tue, 1 Jun 2004 13:06:10 +0000 (13:06 +0000)
immediately after are used so that memory consumption is not
proportional to the size of the response.

PR: 29318

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103810 13f79535-47bb-0310-9956-ffa450edef68

modules/filters/mod_deflate.c

index 07464fe6d5bc4f7ba06579c0b838ceab875ea2b7..e63ba18c4c76b98b78c867647012f46a489a65ca 100644 (file)
@@ -420,16 +420,15 @@ static apr_status_t deflate_out_filter(ap_filter_t *f,
         ctx->stream.avail_out = c->bufferSize;
     }
     
-    for (e = APR_BRIGADE_FIRST(bb);
-         e != APR_BRIGADE_SENTINEL(bb);
-         e = APR_BUCKET_NEXT(e))
+    while (!APR_BRIGADE_EMPTY(bb))
     {
         const char *data;
         apr_bucket *b;
         apr_size_t len;
-
         int done = 0;
 
+        e = APR_BRIGADE_FIRST(bb);
+
         if (APR_BUCKET_IS_EOS(e)) {
             char *buf;
             unsigned int deflate_len;
@@ -516,6 +515,9 @@ static apr_status_t deflate_out_filter(ap_filter_t *f,
         if (APR_BUCKET_IS_FLUSH(e)) {
             apr_bucket *bkt;
             apr_status_t rv;
+
+            apr_bucket_delete(e);
+
             if (ctx->stream.avail_in > 0) {
                 zRC = deflate(&(ctx->stream), Z_SYNC_FLUSH);
                 if (zRC != Z_OK) {
@@ -575,6 +577,8 @@ static apr_status_t deflate_out_filter(ap_filter_t *f,
             if (zRC != Z_OK)
                 return APR_EGENERAL;
         }
+
+        apr_bucket_delete(e);
     }
 
     apr_brigade_cleanup(bb);