cvs: php4 /sapi/cgi cgi_main.c
| From: | Zeev Suraski | Date: | Mon, 26 Jun 2000 15:55:59 +0000 |
| Subject: | cvs: php4 /sapi/cgi cgi_main.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-478@lists.php.net to get a copy of this message | ||
zeev Mon Jun 26 08:55:59 2000 EDT
Modified files:
/php4/sapi/cgi cgi_main.c
Log:
- Fix problem with filename being freed before possible memory leaks are
- reported by the memory manager
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.54 php4/sapi/cgi/cgi_main.c:1.55
--- php4/sapi/cgi/cgi_main.c:1.54 Mon Jun 26 05:26:40 2000
+++ php4/sapi/cgi/cgi_main.c Mon Jun 26 08:55:59 2000
@@ -651,6 +651,8 @@
}
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 @@
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