mike            Mon Jun 19 14:53:03 2006 UTC

  Modified files:              
    /php-src/sapi/cli   php_cli.c 
  Log:
  MFB52: Fix Bug #37780 memory leak trying to execute a non existing file (CLI)
  
  
http://cvs.php.net/viewvc.cgi/php-src/sapi/cli/php_cli.c?r1=1.156&r2=1.157&diff_format=u
Index: php-src/sapi/cli/php_cli.c
diff -u php-src/sapi/cli/php_cli.c:1.156 php-src/sapi/cli/php_cli.c:1.157
--- php-src/sapi/cli/php_cli.c:1.156    Sat Jun  3 22:00:30 2006
+++ php-src/sapi/cli/php_cli.c  Mon Jun 19 14:53:03 2006
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_cli.c,v 1.156 2006/06/03 22:00:30 johannes Exp $ */
+/* $Id: php_cli.c,v 1.157 2006/06/19 14:53:03 mike Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -313,6 +313,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
@@ -374,7 +382,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 */
 
@@ -1254,6 +1262,7 @@
        return 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