diff options
| author | Antony Dovgal <tony2001@php.net> | 2008-07-11 10:24:29 +0000 |
|---|---|---|
| committer | Antony Dovgal <tony2001@php.net> | 2008-07-11 10:24:29 +0000 |
| commit | 3519ed9e3179e3669b14a87b94f4c49cd1e6d7a2 (patch) | |
| tree | 1d49e66b0e693fa76df5a64b8c2a4452a4d153fb /main/streams/streams.c | |
| parent | e5612456de0851d843b3adcc2d493225b82445e8 (diff) | |
| download | php-git-3519ed9e3179e3669b14a87b94f4c49cd1e6d7a2.tar.gz | |
manage references of stream context properly
Diffstat (limited to 'main/streams/streams.c')
| -rwxr-xr-x | main/streams/streams.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/main/streams/streams.c b/main/streams/streams.c index cbc3a25301..fe7f0ff915 100755 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -288,6 +288,7 @@ PHPAPI int _php_stream_free(php_stream *stream, int close_options TSRMLS_DC) /* int remove_rsrc = 1; int preserve_handle = close_options & PHP_STREAM_FREE_PRESERVE_HANDLE ? 1 : 0; int release_cast = 1; + php_stream_context *context = stream->context; if (stream->flags & PHP_STREAM_FLAG_NO_CLOSE) { preserve_handle = 1; @@ -428,6 +429,10 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov #endif } + if (context) { + zend_list_delete(context->rsrc_id); + } + return ret; } /* }}} */ @@ -2414,6 +2419,10 @@ 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); + } + /* if the caller asked for a persistent stream but the wrapper did not * return one, force an error here */ if (stream && (options & STREAM_OPEN_PERSISTENT) && !stream->is_persistent) { |
