wez             Wed Mar 19 19:55:59 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php4/main  streams.c 
  Log:
  Fix for persistent stream shutdown in debug builds.
  
  
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.125.2.47 php4/main/streams.c:1.125.2.48
--- php4/main/streams.c:1.125.2.47      Wed Mar 19 14:27:52 2003
+++ php4/main/streams.c Wed Mar 19 19:55:58 2003
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: streams.c,v 1.125.2.47 2003/03/19 19:27:52 wez Exp $ */
+/* $Id: streams.c,v 1.125.2.48 2003/03/20 00:55:58 wez Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -366,15 +366,22 @@
                        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);
 # else
                        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
@@ -2532,6 +2539,7 @@
        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
@@ -2572,7 +2580,7 @@
 
 #if ZEND_DEBUG
        if (stream) {
-               copy_of_path = estrdup(path);
+               copy_of_path = pestrdup(path, persistent);
                stream->__orig_path = copy_of_path;
        }
 #endif
@@ -2587,7 +2595,7 @@
                                return stream;
                        case PHP_STREAM_RELEASED:
 #if ZEND_DEBUG
-                               newstream->__orig_path = estrdup(path);
+                               newstream->__orig_path = pestrdup(path, persistent);
 #endif
                                return newstream;
                        default:
@@ -2620,7 +2628,7 @@
        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;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to