From: Antony Dovgal Date: Fri, 11 Jul 2008 12:40:20 +0000 (+0000) Subject: not all stream wrappers use context, so no need to addref in all cases X-Git-Tag: BEFORE_HEAD_NS_CHANGE~1310 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ca0a6ec295f54504f657ef5678ee6c4d6bbcbff0;p=php not all stream wrappers use context, so no need to addref in all cases --- 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