summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-06-26 15:55:59 +0000
committerZeev Suraski <zeev@php.net>2000-06-26 15:55:59 +0000
commiteffa42696ec5ef889da5c86c4ff3feefb5673f03 (patch)
treed677a7bf4c59aeff167d71c1c55619a385b9efb1
parent1a22c1eb86da19ef2d4de9acdf8ebd22e92fc621 (diff)
downloadphp-git-effa42696ec5ef889da5c86c4ff3feefb5673f03.tar.gz
- Fix problem with filename being freed before possible memory leaks are
- reported by the memory manager
-rw-r--r--sapi/cgi/cgi_main.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 5a7a805b0d..6770c5d285 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -651,6 +651,8 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
}
file_handle.free_filename = 0;
+ /* Duplicate the filename with strdup() so that the memory manager doesn't nuke it too early */
+ file_handle.filename = strdup(file_handle.filename);
switch (behavior) {
case PHP_MODE_STANDARD:
php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
@@ -667,21 +669,25 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
return 0;
}
break;
+#if 0
+ /* Zeev might want to do something with this one day */
case PHP_MODE_INDENT:
open_file_for_scanning(&file_handle CLS_CC);
zend_indent();
fclose(file_handle.handle.fp);
return 0;
break;
+#endif
}
php_header(); /* Make sure headers have been sent */
STR_FREE(SG(request_info).path_translated);
- SG(request_info).path_translated = NULL;
php_request_shutdown((void *) 0);
php_module_shutdown();
+
+ free(file_handle.filename);
#ifdef ZTS
tsrm_shutdown();
#endif