summaryrefslogtreecommitdiff
path: root/main/streams/streams.c
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2008-07-11 12:40:20 +0000
committerAntony Dovgal <tony2001@php.net>2008-07-11 12:40:20 +0000
commitca0a6ec295f54504f657ef5678ee6c4d6bbcbff0 (patch)
tree6fbbdebac368f4e50e097abe7ef211cb9fa7e68a /main/streams/streams.c
parent5003bfc02851c0368062d30f3cb9f99d542684d6 (diff)
downloadphp-git-ca0a6ec295f54504f657ef5678ee6c4d6bbcbff0.tar.gz
not all stream wrappers use context, so no need to addref in all cases
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