summaryrefslogtreecommitdiff
path: root/main/streams/streams.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/streams/streams.c')
-rwxr-xr-xmain/streams/streams.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/main/streams/streams.c b/main/streams/streams.c
index fe7f0ff915..f1b74a49d5 100755
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -2419,8 +2419,9 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int optio
opened_path, context STREAMS_REL_CC TSRMLS_CC);
}
- if (context) {
- zend_list_addref(context->rsrc_id);
+ /* increase context refcount only if the context is really used */
+ if (stream && stream->context) {
+ zend_list_addref(stream->context->rsrc_id);
}
/* if the caller asked for a persistent stream but the wrapper did not