From ca0a6ec295f54504f657ef5678ee6c4d6bbcbff0 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Fri, 11 Jul 2008 12:40:20 +0000 Subject: [PATCH] not all stream wrappers use context, so no need to addref in all cases --- main/streams/streams.c | 5 +++-- 1 file 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 -- 2.50.1