com php-src: Keep resource of enclosing stream, because it may be referenced from other place(s). This fixes valgrind warnings on
Zend/tests/type_declarations/scalar_basic.phpt: main/ streams/streams.c
| From: | Dmitry Stogov | Date: | Wed, 19 Jul 2017 14:16:56 +0000 |
| Subject: | com php-src: Keep resource of enclosing stream, because it may be referenced from other place(s). This fixes valgrind warnings on Zend/tests/type_declarations/scalar_basic.phpt: main/ streams/streams.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-98638@lists.php.net to get a copy of this message | ||
Commit: 6fcc7134f1d4aaf60e24202ed316c61636c5a95d
Author: Dmitry Stogov <dmitry@zend.com> Wed, 19 Jul 2017 17:16:56 +0300
Parents: 112eda7525a616e007b3abbadabc4c9047695bc3
Branches: PHP-7.2 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6fcc7134f1d4aaf60e24202ed316c61636c5a95d
Log:
Keep resource of enclosing stream, because it may be referenced from other place(s).
This fixes valgrind warnings on Zend/tests/type_declarations/scalar_basic.phpt
Changed paths:
M main/streams/streams.c
Diff:
diff --git a/main/streams/streams.c b/main/streams/streams.c
index 23d4645..dab8505 100644
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -405,10 +405,9 @@ PHPAPI int _php_stream_free(php_stream *stream, int close_options) /* {{{ */
php_stream *enclosing_stream = stream->enclosing_stream;
stream->enclosing_stream = NULL;
/* we force PHP_STREAM_CALL_DTOR because that's from where the
- * enclosing stream can free this stream. We remove rsrc_dtor because
- * we want the enclosing stream to be deleted from the resource list */
+ * enclosing stream can free this stream. */
return php_stream_free(enclosing_stream,
- (close_options | PHP_STREAM_FREE_CALL_DTOR) & ~PHP_STREAM_FREE_RSRC_DTOR);
+ (close_options | PHP_STREAM_FREE_CALL_DTOR | PHP_STREAM_FREE_KEEP_RSRC) &
~PHP_STREAM_FREE_RSRC_DTOR);
}
/* if we are releasing the stream only (and preserving the underlying handle),