]> granicus.if.org Git - php/commitdiff
Fixed bug #41304 (compress.zlib temp files left)
authorDmitry Stogov <dmitry@php.net>
Tue, 8 May 2007 12:08:17 +0000 (12:08 +0000)
committerDmitry Stogov <dmitry@php.net>
Tue, 8 May 2007 12:08:17 +0000 (12:08 +0000)
NEWS
ext/zlib/zlib_fopen_wrapper.c
main/streams/streams.c

diff --git a/NEWS b/NEWS
index 5df902868337c84f30ae52acf7bb76e7be9cb3f3..6187f472432445f54dc4d065a0e1ec1aa8191303 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ PHP                                                                        NEWS
   (Ilia)
 - Fixed altering $this via argument named "this". (Dmitry)
 - Fixed PHP CLI to use the php.ini from the binary location. (Hannes)
+- Fixed bug #41304 (compress.zlib temp files left). (Dmitry)
 - Fixed bug #41293 (Fixed creation of HTTP_RAW_POST_DATA when there is no
   default post handler). (Ilia)
 - Fixed gd build when used with freetype 1.x (Pierre, Tony)
index 5e45edc31f80f83a6c7085c9bd9a7b2a4dc1b8c9..bab79b974029a9fdfc371909059598cb8de3db99 100644 (file)
@@ -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);
index 188e4a9c651cb42285adb88b941d8db697357e31..8a0a925f992beb3c2caa85db6ecbb1aca9f1012d 100755 (executable)
@@ -1809,6 +1809,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: