diff options
author | Moriyoshi Koizumi <moriyoshi@php.net> | 2003-03-28 18:24:02 +0000 |
---|---|---|
committer | Moriyoshi Koizumi <moriyoshi@php.net> | 2003-03-28 18:24:02 +0000 |
commit | 2ad3f446c3b703d88f18dd54f2aaef4b250e96f8 (patch) | |
tree | 37fd0ff1b3d46d5a2b1d9986ae9b1f2ca18cb504 | |
parent | 0b6f629b68abc75c074f2dd327c6be03c225c012 (diff) | |
download | php-git-2ad3f446c3b703d88f18dd54f2aaef4b250e96f8.tar.gz |
Do the right fix..
-rw-r--r-- | sapi/cgi/cgi_main.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 30962e4b59..12bc234820 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -389,7 +389,10 @@ static char *_sapi_cgibin_putenv(char *name, char *value TSRMLS_DC) char *buf = NULL; if (!name) return NULL; len = strlen(name) + (value?strlen(value):0) + sizeof("=") + 2; - buf = (char *)emalloc(len); + buf = (char *)malloc(len); + if (buf == NULL) { + return getenv(name); + } if (value) { snprintf(buf,len-1,"%s=%s", name, value); } else { @@ -403,7 +406,7 @@ static char *_sapi_cgibin_putenv(char *name, char *value TSRMLS_DC) if (!FCGX_IsCGI()) { FCGX_Request *request = (FCGX_Request *)SG(server_context); FCGX_PutEnv(request,buf); - efree(buf); + free(buf); return sapi_cgibin_getenv(name,0 TSRMLS_CC); } #endif @@ -412,11 +415,7 @@ static char *_sapi_cgibin_putenv(char *name, char *value TSRMLS_DC) this leaks, but it's only cgi anyway, we'll fix it for 5.0 */ - if (value) - putenv(strdup(buf)); - else - putenv(buf); - efree(buf); + putenv(buf); return getenv(name); } @@ -808,8 +807,8 @@ static void init_request_info(TSRMLS_D) } else { /* make sure path_info/translated are empty */ script_path_translated = _sapi_cgibin_putenv("SCRIPT_FILENAME",script_path_translated TSRMLS_CC); - _sapi_cgibin_putenv("PATH_INFO", "" TSRMLS_CC); - _sapi_cgibin_putenv("PATH_TRANSLATED", "" TSRMLS_CC); + _sapi_cgibin_putenv("PATH_INFO", NULL TSRMLS_CC); + _sapi_cgibin_putenv("PATH_TRANSLATED", NULL TSRMLS_CC); } SG(request_info).request_uri = sapi_cgibin_getenv("SCRIPT_NAME",0 TSRMLS_CC); } else { |