summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2007-05-08 12:08:41 +0000
committerDmitry Stogov <dmitry@php.net>2007-05-08 12:08:41 +0000
commit0ddb071abbe9357e89d2f60409a323ac2d8377aa (patch)
tree2eec0f832a6724545e5eddc1147a44506c42a4a5
parent05a84ea7f7c46009060528d55b4a78bbc73d3194 (diff)
downloadphp-git-0ddb071abbe9357e89d2f60409a323ac2d8377aa.tar.gz
Fixed bug #41304 (compress.zlib temp files left)
-rw-r--r--ext/zlib/zlib_fopen_wrapper.c4
-rwxr-xr-xmain/streams/streams.c3
2 files changed, 5 insertions, 2 deletions
diff --git a/ext/zlib/zlib_fopen_wrapper.c b/ext/zlib/zlib_fopen_wrapper.c
index c3a5b238b8..bc12095b5e 100644
--- a/ext/zlib/zlib_fopen_wrapper.c
+++ b/ext/zlib/zlib_fopen_wrapper.c
@@ -76,7 +76,7 @@ static int php_gziop_close(php_stream *stream, int close_handle TSRMLS_DC)
self->gz_file = NULL;
}
if (self->stream) {
- php_stream_free(self->stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_PRESERVE_HANDLE);
+ php_stream_close(self->stream);
self->stream = NULL;
}
}
@@ -130,7 +130,7 @@ php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, char *path, char *mod
int fd;
if (SUCCESS == php_stream_cast(innerstream, PHP_STREAM_AS_FD, (void **) &fd, REPORT_ERRORS)) {
- self->gz_file = gzdopen(fd, mode);
+ self->gz_file = gzdopen(dup(fd), mode);
self->stream = innerstream;
if (self->gz_file) {
stream = php_stream_alloc_rel(&php_stream_gzio_ops, self, 0, mode);
diff --git a/main/streams/streams.c b/main/streams/streams.c
index de3715855e..24496d7c54 100755
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -2433,6 +2433,9 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int optio
case PHP_STREAM_UNCHANGED:
return stream;
case PHP_STREAM_RELEASED:
+ if (newstream->orig_path) {
+ pefree(newstream->orig_path, persistent);
+ }
newstream->orig_path = pestrdup(path, persistent);
return newstream;
default: