]> granicus.if.org Git - php/commitdiff
- Fix Bug #37780 memory leak trying to execute a non existing file (CLI)
authorMichael Wallner <mike@php.net>
Mon, 19 Jun 2006 14:52:34 +0000 (14:52 +0000)
committerMichael Wallner <mike@php.net>
Mon, 19 Jun 2006 14:52:34 +0000 (14:52 +0000)
NEWS
sapi/cli/php_cli.c

diff --git a/NEWS b/NEWS
index 1ed2d21639c5122ff4bdd76b9eefbde6a848c55e..fa33aeccbace14463faf2600e10750ac617eaccb 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -63,6 +63,8 @@ PHP                                                                        NEWS
 
 - Fixed memory leaks in openssl streams context options. (Pierre)
 - Fixed handling of extremely long paths inside tempnam() function. (Ilia)
+- Fixed bug #37780 (memory leak trying to execute a non existing file (CLI)).
+  (Mike)
 - Fixed bug #37747 (strtotime segfaults when given "nextyear"). (Derick)
 - Fixed bug #37720 (merge_php_config scrambles values). (Mike,
   pumuckel at metropolis dot de)
index 15f69181259dc2f0264190d6575cb1cc0366a913..684d7f9e4506eb042ed16b42d88bce048c46b265 100644 (file)
@@ -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;