mike            Mon Jun 19 14:52:34 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src    NEWS 
    /php-src/sapi/cli   php_cli.c 
  Log:
  - Fix Bug #37780 memory leak trying to execute a non existing file (CLI)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.89&r2=1.2027.2.547.2.90&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.89 php-src/NEWS:1.2027.2.547.2.90
--- php-src/NEWS:1.2027.2.547.2.89      Mon Jun 19 02:19:13 2006
+++ php-src/NEWS        Mon Jun 19 14:52:34 2006
@@ -63,6 +63,8 @@
 
 - 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)
http://cvs.php.net/viewvc.cgi/php-src/sapi/cli/php_cli.c?r1=1.129.2.13.2.3&r2=1.129.2.13.2.4&diff_format=u
Index: php-src/sapi/cli/php_cli.c
diff -u php-src/sapi/cli/php_cli.c:1.129.2.13.2.3 
php-src/sapi/cli/php_cli.c:1.129.2.13.2.4
--- php-src/sapi/cli/php_cli.c:1.129.2.13.2.3   Sat Jun  3 22:02:02 2006
+++ php-src/sapi/cli/php_cli.c  Mon Jun 19 14:52:34 2006
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_cli.c,v 1.129.2.13.2.3 2006/06/03 22:02:02 johannes Exp $ */
+/* $Id: php_cli.c,v 1.129.2.13.2.4 2006/06/19 14:52:34 mike Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -305,6 +305,14 @@
        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 @@
 
        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 @@
        exit(exit_status);
 
 err:
+       sapi_deactivate(TSRMLS_C);
        zend_ini_deactivate(TSRMLS_C);
        exit_status = 1;
        goto out_err;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to