summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--Zend/zend-scanner.l2
-rw-r--r--Zend/zend.c2
-rw-r--r--Zend/zend_execute.c2
-rw-r--r--main/configuration-parser.y3
-rw-r--r--main/fopen_wrappers.c3
6 files changed, 9 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index 8a75ae1bc3..3ba1a1c1c8 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ PHP 4.0 NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2000, Version 4.0.3-dev
+- Internal opened_path variable now uses the Zend memory manager so that full
+ paths of files won't leak on unclean shutdown (Andi)
- Removed support of print $obj automatically calling the __string_value()
method. Instead define yourself a method such as toString() and use
print $obj->toString() (Andi, Zend Engine)
diff --git a/Zend/zend-scanner.l b/Zend/zend-scanner.l
index b78ff8cd46..99feccfceb 100644
--- a/Zend/zend-scanner.l
+++ b/Zend/zend-scanner.l
@@ -207,7 +207,7 @@ ZEND_API void zend_file_handle_dtor(zend_file_handle *fh)
#endif
}
if (fh->opened_path) {
- free(fh->opened_path);
+ efree(fh->opened_path);
}
if (fh->free_filename && fh->filename) {
efree(fh->filename);
diff --git a/Zend/zend.c b/Zend/zend.c
index 304f4740dd..3ba958f11a 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -214,7 +214,7 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int
static FILE *zend_fopen_wrapper(const char *filename, char **opened_path)
{
if (opened_path) {
- *opened_path = strdup(filename);
+ *opened_path = estrdup(filename);
}
return fopen(filename, "rb");
}
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index f8d1c17322..6232490bf3 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -2000,7 +2000,7 @@ send_by_ref:
}
}
if (opened_path) {
- free(opened_path);
+ efree(opened_path);
}
break;
}
diff --git a/main/configuration-parser.y b/main/configuration-parser.y
index 374d680bd7..dcef335ea0 100644
--- a/main/configuration-parser.y
+++ b/main/configuration-parser.y
@@ -223,13 +223,14 @@ int php_init_config(void)
if (opened_path) {
zval tmp;
- tmp.value.str.val = opened_path;
+ tmp.value.str.val = strdup(opened_path);
tmp.value.str.len = strlen(opened_path);
tmp.type = IS_STRING;
zend_hash_update(&configuration_hash,"cfg_file_path",sizeof("cfg_file_path"),(void *) &tmp,sizeof(zval),NULL);
#if DEBUG_CFG_PARSER
php_printf("INI file opened at '%s'\n",opened_path);
#endif
+ efree(opened_path);
}
init_cfg_scanner();
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index 638c771c9b..fa7c053f4b 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -1077,7 +1077,8 @@ PHPAPI char *expand_filepath(const char *filepath, char *real_path)
memcpy(real_path,new_state.cwd,copy_len);
real_path[copy_len]='\0';
} else {
- real_path = new_state.cwd;
+ real_path = estrndup(new_state.cwd, new_state.cwd_length);
+ free(new_state.cwd);
}
return real_path;