summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmain/streams/streams.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/main/streams/streams.c b/main/streams/streams.c
index b3dff8abb0..c027b3067e 100755
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -336,7 +336,10 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov
char leakbuf[512];
snprintf(leakbuf, sizeof(leakbuf), __FILE__ "(%d) : Stream of type '%s' 0x%08X (path:%s) was not closed\n", __LINE__, stream->ops->label, (unsigned int)stream, stream->__orig_path);
- STR_FREE(stream->__orig_path);
+ if (stream->__orig_path) {
+ pefree(stream->__orig_path, stream->is_persistent);
+ stream->__orig_path = NULL;
+ }
# if defined(PHP_WIN32)
OutputDebugString(leakbuf);
@@ -344,7 +347,11 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov
fprintf(stderr, "%s", leakbuf);
# endif
} else {
- STR_FREE(stream->__orig_path);
+ if (stream->__orig_path) {
+ pefree(stream->__orig_path, stream->is_persistent);
+ stream->__orig_path = NULL;
+ }
+
pefree(stream, stream->is_persistent);
}
#else
@@ -1437,6 +1444,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int optio
php_stream *stream = NULL;
php_stream_wrapper *wrapper = NULL;
char *path_to_open;
+ int persistent = options & STREAM_OPEN_PERSISTENT;
#if ZEND_DEBUG
char *copy_of_path = NULL;
#endif
@@ -1478,7 +1486,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int optio
#if ZEND_DEBUG
if (stream) {
- copy_of_path = estrdup(path);
+ copy_of_path = pestrdup(path, persistent);
stream->__orig_path = copy_of_path;
}
#endif
@@ -1493,7 +1501,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int optio
return stream;
case PHP_STREAM_RELEASED:
#if ZEND_DEBUG
- newstream->__orig_path = estrdup(path);
+ newstream->__orig_path = pestrdup(path, persistent);
#endif
return newstream;
default:
@@ -1526,7 +1534,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int optio
php_stream_tidy_wrapper_error_log(wrapper TSRMLS_CC);
#if ZEND_DEBUG
if (stream == NULL && copy_of_path != NULL) {
- efree(copy_of_path);
+ pefree(copy_of_path, persistent);
}
#endif
return stream;