From: Michael Wallner Date: Mon, 19 Jun 2006 14:53:03 +0000 (+0000) Subject: MFB52: Fix Bug #37780 memory leak trying to execute a non existing file (CLI) X-Git-Tag: RELEASE_1_0_0RC1~2698 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dbfa7271c864b19afb2163baae9a70a07ac9153c;p=php MFB52: Fix Bug #37780 memory leak trying to execute a non existing file (CLI) --- diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 8fe2d03aa9..ccb3f4152b 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -313,6 +313,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 @@ -374,7 +382,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 */ @@ -1254,6 +1262,7 @@ out_err: return exit_status; err: + sapi_deactivate(TSRMLS_C); zend_ini_deactivate(TSRMLS_C); exit_status = 1; goto out_err;