summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorMichael Wallner <mike@php.net>2006-06-19 14:52:34 +0000
committerMichael Wallner <mike@php.net>2006-06-19 14:52:34 +0000
commitf4106441cb85478f589ee921cd570795cfd8f9ce (patch)
tree47ab496d27c38b6c44986879a02062e11c355ab2 /sapi
parent20ee84dea69ea34de67a12515e2e3ba481957f62 (diff)
downloadphp-git-f4106441cb85478f589ee921cd570795cfd8f9ce.tar.gz
- Fix Bug #37780 memory leak trying to execute a non existing file (CLI)
Diffstat (limited to 'sapi')
-rw-r--r--sapi/cli/php_cli.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 15f6918125..684d7f9e45 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -305,6 +305,14 @@ static char* sapi_cli_read_cookies(TSRMLS_D)
return NULL;
}
+static int sapi_cli_header_handler(sapi_header_struct *h, sapi_headers_struct *s TSRMLS_DC)
+{
+ /* free allocated header line */
+ efree(h->header);
+ /* avoid pushing headers into SAPI headers list */
+ return 0;
+}
+
static int sapi_cli_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
{
/* We do nothing here, this function is needed to prevent that the fallback
@@ -370,7 +378,7 @@ static sapi_module_struct cli_sapi_module = {
php_error, /* error handler */
- NULL, /* header handler */
+ sapi_cli_header_handler, /* header handler */
sapi_cli_send_headers, /* send headers handler */
sapi_cli_send_header, /* send header handler */
@@ -1255,6 +1263,7 @@ out_err:
exit(exit_status);
err:
+ sapi_deactivate(TSRMLS_C);
zend_ini_deactivate(TSRMLS_C);
exit_status = 1;
goto out_err;