]> granicus.if.org Git - php/commitdiff
MFH(r-1.49)Bugfix#36492 Userfilters can leak buckets
authorSara Golemon <pollita@php.net>
Sat, 4 Aug 2007 07:53:00 +0000 (07:53 +0000)
committerSara Golemon <pollita@php.net>
Sat, 4 Aug 2007 07:53:00 +0000 (07:53 +0000)
NEWS
ext/standard/user_filters.c

diff --git a/NEWS b/NEWS
index fe7cf7fd6eef80be70528ec59c369e23169105a2..086e9b29918053aab6674da3c02eb4593e197d9f 100644 (file)
--- 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)
index 321ef58532608ea2f1a87f9026c98f975cc1c8a1..2423f6b5e135470587c7d02a61732313a7bf712a 100644 (file)
@@ -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);