From: Sara Golemon Date: Sat, 4 Aug 2007 07:53:00 +0000 (+0000) Subject: MFH(r-1.49)Bugfix#36492 Userfilters can leak buckets X-Git-Tag: php-5.2.4RC2~95 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6f25b84a3abb84b9f598ececce61768cd76d7c60;p=php MFH(r-1.49)Bugfix#36492 Userfilters can leak buckets --- diff --git a/NEWS b/NEWS index fe7cf7fd6e..086e9b2991 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Aug 2007, PHP 5.2.4 +- Fixed bug #36492 (Userfilters can leak buckets). (Sara) 02 Aug 2007, PHP 5.2.4RC1 - Removed --enable-versioning configure option. (Jani) diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index 321ef58532..2423f6b5e1 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -232,8 +232,21 @@ php_stream_filter_status_t userfilter_filter( *bytes_consumed = Z_LVAL_P(zconsumed); } - if (retval) + if (retval) { zval_ptr_dtor(&retval); + } + + if (buckets_in->head) { + php_stream_bucket *bucket = buckets_in->head; + + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unprocessed filter buckets remaining on input brigade"); + while ((bucket = buckets_in->head)) { + /* Remove unconsumed buckets from the brigade */ + php_stream_bucket_unlink(bucket TSRMLS_CC); + php_stream_bucket_delref(bucket TSRMLS_CC); + } + } + zval_ptr_dtor(&zclosing); zval_ptr_dtor(&zconsumed); zval_ptr_dtor(&zout);