summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend_language_scanner.l3
-rw-r--r--Zend/zend_stream.c4
-rw-r--r--Zend/zend_stream.h3
-rw-r--r--ext/phar/phar.c1
-rw-r--r--sapi/litespeed/lsapi_main.c2
-rw-r--r--sapi/phpdbg/phpdbg_list.c4
6 files changed, 17 insertions, 0 deletions
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l
index fadd2f2a50..1537fa36f8 100644
--- a/Zend/zend_language_scanner.l
+++ b/Zend/zend_language_scanner.l
@@ -292,6 +292,9 @@ ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle)
zend_llist_del_element(&CG(open_files), file_handle, (int (*)(void *, void *)) zend_compare_file_handles);
/* zend_file_handle_dtor() operates on the copy, so we have to NULLify the original here */
file_handle->opened_path = NULL;
+ if (file_handle->free_filename) {
+ file_handle->filename = NULL;
+ }
}
ZEND_API void zend_lex_tstring(zval *zv)
diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c
index a3490ffc93..4dffc31040 100644
--- a/Zend/zend_stream.c
+++ b/Zend/zend_stream.c
@@ -223,6 +223,10 @@ ZEND_API void zend_file_handle_dtor(zend_file_handle *fh) /* {{{ */
efree(fh->buf);
fh->buf = NULL;
}
+ if (fh->free_filename && fh->filename) {
+ efree((char*)fh->filename);
+ fh->filename = NULL;
+ }
}
/* }}} */
diff --git a/Zend/zend_stream.h b/Zend/zend_stream.h
index 66a7e5198c..51651add38 100644
--- a/Zend/zend_stream.h
+++ b/Zend/zend_stream.h
@@ -56,6 +56,9 @@ typedef struct _zend_file_handle {
const char *filename;
zend_string *opened_path;
zend_stream_type type;
+ /* free_filename is used by wincache */
+ /* TODO: Clean up filename vs opened_path mess */
+ zend_bool free_filename;
char *buf;
size_t len;
} zend_file_handle;
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index 0deec63368..93a0387366 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -3261,6 +3261,7 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type)
efree(f.opened_path);
}
f.opened_path = file_handle->opened_path;
+ f.free_filename = file_handle->free_filename;
switch (file_handle->type) {
case ZEND_HANDLE_STREAM:
diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c
index a851212c85..f7d4b1a84c 100644
--- a/sapi/litespeed/lsapi_main.c
+++ b/sapi/litespeed/lsapi_main.c
@@ -1338,6 +1338,7 @@ static int cli_main( int argc, char * argv[] )
highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini);
} else if (source_highlight == 2) {
file_handle.filename = *p;
+ file_handle.free_filename = 0;
file_handle.opened_path = NULL;
ret = php_lint_script(&file_handle);
if (ret==SUCCESS) {
@@ -1348,6 +1349,7 @@ static int cli_main( int argc, char * argv[] )
} else {
file_handle.filename = *p;
+ file_handle.free_filename = 0;
file_handle.opened_path = NULL;
php_execute_script(&file_handle);
diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c
index fe612be325..03b4c3526e 100644
--- a/sapi/phpdbg/phpdbg_list.c
+++ b/sapi/phpdbg/phpdbg_list.c
@@ -294,6 +294,10 @@ zend_op_array *phpdbg_init_compile_file(zend_file_handle *file, int type) {
zend_string_release(file->opened_path);
file->opened_path = zend_string_init(filename, strlen(filename), 0);
} else {
+ if (file->free_filename) {
+ efree((char *) file->filename);
+ }
+ file->free_filename = 0;
file->filename = filename;
}
}