summaryrefslogtreecommitdiff
path: root/main/streams/streams.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2017-07-19 17:16:56 +0300
committerDmitry Stogov <dmitry@zend.com>2017-07-19 17:16:56 +0300
commit6fcc7134f1d4aaf60e24202ed316c61636c5a95d (patch)
tree2bfa77224d2435a1a8cf73a7a20283a6ff00e92a /main/streams/streams.c
parent112eda7525a616e007b3abbadabc4c9047695bc3 (diff)
downloadphp-git-6fcc7134f1d4aaf60e24202ed316c61636c5a95d.tar.gz
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
Diffstat (limited to 'main/streams/streams.c')
-rw-r--r--main/streams/streams.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/main/streams/streams.c b/main/streams/streams.c
index 23d46455c1..dab8505d41 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),