summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorJani Taskinen <jani@php.net>2009-09-10 16:19:42 (GMT)
committerJani Taskinen <jani@php.net>2009-09-10 16:19:42 (GMT)
commitccd6e501d19f447fb2e11cbcfe31188f7d6d0dd5 (patch)
tree38477ed660494abe8b479824b2b58bb298ff5938 /sapi
parent0f1b93a1ca76ee3112bc3d99a0847dcf27c36996 (diff)
downloadphp-ccd6e501d19f447fb2e11cbcfe31188f7d6d0dd5.tar.gz
- Simplified a bit and fixed possible memory corruption and definate leak.
Diffstat (limited to 'sapi')
-rw-r--r--sapi/cgi/cgi_main.c29
1 files changed, 6 insertions, 23 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 531884e..2a424e2 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -1280,9 +1280,6 @@ static void init_request_info(TSRMLS_D)
if (pt) {
efree(pt);
}
- if (is_valid_path(script_path_translated)) {
- SG(request_info).path_translated = estrdup(script_path_translated);
- }
} else {
/* make sure path_info/translated are empty */
if (!orig_script_filename ||
@@ -1311,9 +1308,6 @@ static void init_request_info(TSRMLS_D)
} else {
SG(request_info).request_uri = env_script_name;
}
- if (is_valid_path(script_path_translated)) {
- SG(request_info).path_translated = estrdup(script_path_translated);
- }
free(real_path);
}
} else {
@@ -1326,9 +1320,10 @@ static void init_request_info(TSRMLS_D)
if (!CGIG(discard_path) && env_path_translated) {
script_path_translated = env_path_translated;
}
- if (is_valid_path(script_path_translated)) {
- SG(request_info).path_translated = estrdup(script_path_translated);
- }
+ }
+
+ if (is_valid_path(script_path_translated)) {
+ SG(request_info).path_translated = estrdup(script_path_translated);
}
SG(request_info).request_method = sapi_cgibin_getenv("REQUEST_METHOD", sizeof("REQUEST_METHOD")-1 TSRMLS_CC);
@@ -2131,26 +2126,14 @@ consult the installation file that came with this distribution, or visit \n\
fastcgi_request_done:
{
- char *path_translated;
-
- /* Go through this trouble so that the memory manager doesn't warn
- * about SG(request_info).path_translated leaking
- */
- if (SG(request_info).path_translated) {
- path_translated = strdup(SG(request_info).path_translated);
- STR_FREE(SG(request_info).path_translated);
- SG(request_info).path_translated = path_translated;
- }
+ STR_FREE(SG(request_info).path_translated);
php_request_shutdown((void *) 0);
+
if (exit_status == 0) {
exit_status = EG(exit_status);
}
- if (SG(request_info).path_translated) {
- free(SG(request_info).path_translated);
- SG(request_info).path_translated = NULL;
- }
if (free_query_string && SG(request_info).query_string) {
free(SG(request_info).query_string);
SG(request_info).query_string = NULL;