diff options
author | Clement Laforet <clement@FreeBSD.org> | 2005-03-15 22:18:54 +0000 |
---|---|---|
committer | Clement Laforet <clement@FreeBSD.org> | 2005-03-15 22:18:54 +0000 |
commit | c9adf29fa4551878a5b04bac10f9f6fd602cd587 (patch) | |
tree | b2c2a2af7b15b991da16a2b1a013c994fc01cd73 /www/apache2 | |
parent | - Update to 4.39.6 (diff) |
- Fix memory leak
*) core_input_filter: Move buckets to a persistent brigade instead of
creating a new brigade. This stop a memory leak when proxying a
Streaming Media Server.
Obtained from: Apache httpd repository
Notes
Notes:
svn path=/head/; revision=131343
Diffstat (limited to 'www/apache2')
-rw-r--r-- | www/apache2/Makefile | 1 | ||||
-rw-r--r-- | www/apache2/files/patch-fix-core_input_filter | 77 |
2 files changed, 78 insertions, 0 deletions
diff --git a/www/apache2/Makefile b/www/apache2/Makefile index e98b2e0ae9e9..526ef1f85cf2 100644 --- a/www/apache2/Makefile +++ b/www/apache2/Makefile @@ -9,6 +9,7 @@ PORTNAME= apache PORTVERSION= 2.0.53 +PORTREVISION= 1 CATEGORIES= www MASTER_SITES= ${MASTER_SITE_APACHE_HTTPD} \ ${MASTER_SITE_LOCAL:S/%SUBDIR%/clement/}:powerlogo diff --git a/www/apache2/files/patch-fix-core_input_filter b/www/apache2/files/patch-fix-core_input_filter new file mode 100644 index 000000000000..bdad48deb0ab --- /dev/null +++ b/www/apache2/files/patch-fix-core_input_filter @@ -0,0 +1,77 @@ +--- include/httpd.h 2005/02/26 08:26:18 155390 ++++ include/httpd.h 2005/02/26 09:04:10 155391 +@@ -1100,6 +1100,7 @@ + + typedef struct core_filter_ctx { + apr_bucket_brigade *b; ++ apr_bucket_brigade *tmpbb; + } core_ctx_t; + + typedef struct core_net_rec { +--- server/core.c 2005/02/26 08:26:18 155390 ++++ server/core.c 2005/02/26 09:04:10 155391 +@@ -3674,6 +3674,28 @@ + } while (!APR_BRIGADE_EMPTY(b) && (e != APR_BRIGADE_SENTINEL(b))); \ + } while (0) + ++ ++/** ++ * Split the contents of a brigade after bucket 'e' to an existing brigade ++ * ++ * XXXX: Should this function be added to APR-Util? ++ */ ++static void brigade_move(apr_bucket_brigade *b, apr_bucket_brigade *a, ++ apr_bucket *e) ++{ ++ apr_bucket *f; ++ ++ if (e != APR_BRIGADE_SENTINEL(b)) { ++ f = APR_RING_LAST(&b->list); ++ APR_RING_UNSPLICE(e, f, link); ++ APR_RING_SPLICE_HEAD(&a->list, e, f, apr_bucket, link); ++ } ++ ++ APR_BRIGADE_CHECK_CONSISTENCY(a); ++ APR_BRIGADE_CHECK_CONSISTENCY(b); ++} ++ ++ + static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, + ap_input_mode_t mode, apr_read_type_e block, + apr_off_t readbytes) +@@ -3703,6 +3725,7 @@ + { + ctx = apr_pcalloc(f->c->pool, sizeof(*ctx)); + ctx->b = apr_brigade_create(f->c->pool, f->c->bucket_alloc); ++ ctx->tmpbb = apr_brigade_create(ctx->b->p, ctx->b->bucket_alloc); + + /* seed the brigade with the client socket. */ + e = apr_bucket_socket_create(net->client_socket, f->c->bucket_alloc); +@@ -3814,7 +3837,6 @@ + /* read up to the amount they specified. */ + if (mode == AP_MODE_READBYTES || mode == AP_MODE_SPECULATIVE) { + apr_bucket *e; +- apr_bucket_brigade *newbb; + + AP_DEBUG_ASSERT(readbytes > 0); + +@@ -3855,8 +3877,8 @@ + return rv; + } + +- /* Must do split before CONCAT */ +- newbb = apr_brigade_split(ctx->b, e); ++ /* Must do move before CONCAT */ ++ brigade_move(ctx->b, ctx->tmpbb, e); + + if (mode == AP_MODE_READBYTES) { + APR_BRIGADE_CONCAT(b, ctx->b); +@@ -3873,7 +3895,7 @@ + } + + /* Take what was originally there and place it back on ctx->b */ +- APR_BRIGADE_CONCAT(ctx->b, newbb); ++ APR_BRIGADE_CONCAT(ctx->b, ctx->tmpbb); + } + return APR_SUCCESS; + } |