wez Wed Mar 19 20:23:05 2003 EDT
Modified files:
/php4/main/streams streams.c
Log:
Fix for persistent stream shutdown under debug builds
Index: php4/main/streams/streams.c
diff -u php4/main/streams/streams.c:1.13 php4/main/streams/streams.c:1.14
--- php4/main/streams/streams.c:1.13 Tue Mar 18 19:17:15 2003
+++ php4/main/streams/streams.c Wed Mar 19 20:23:04 2003
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c,v 1.13 2003/03/19 00:17:15 wez Exp $ */
+/* $Id: streams.c,v 1.14 2003/03/20 01:23:04 wez Exp $ */
#define _GNU_SOURCE
#include "php.h"
@@ -336,7 +336,10 @@
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, "%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 @@
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 @@
#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 @@
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 @@
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;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php