dmitry          Tue Apr 18 06:58:43 2006 UTC

  Modified files:              (Branch: PHP_5_1)
    /php-src/main       php_variables.c 
  Log:
  Fixed memory leaks
  
  
http://cvs.php.net/viewcvs.cgi/php-src/main/php_variables.c?r1=1.104.2.8&r2=1.104.2.9&diff_format=u
Index: php-src/main/php_variables.c
diff -u php-src/main/php_variables.c:1.104.2.8 
php-src/main/php_variables.c:1.104.2.9
--- php-src/main/php_variables.c:1.104.2.8      Fri Apr  7 13:57:27 2006
+++ php-src/main/php_variables.c        Tue Apr 18 06:58:43 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_variables.c,v 1.104.2.8 2006/04/07 13:57:27 dmitry Exp $ */
+/* $Id: php_variables.c,v 1.104.2.9 2006/04/18 06:58:43 dmitry Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -421,10 +421,8 @@
                return;
        }
        
-       ALLOC_ZVAL(arr);
+       ALLOC_INIT_ZVAL(arr);
        array_init(arr);
-       arr->is_ref = 0;
-       arr->refcount = 0;
 
        /* Prepare argv */
        if (SG(request_info).argc) { /* are we in cli sapi? */
@@ -470,15 +468,13 @@
        }
 
        /* prepare argc */
-       ALLOC_ZVAL(argc);
+       ALLOC_INIT_ZVAL(argc);
        if (SG(request_info).argc) {
                Z_LVAL_P(argc) = SG(request_info).argc;
        } else {
                Z_LVAL_P(argc) = count;
        }
        Z_TYPE_P(argc) = IS_LONG;
-       argc->is_ref = 0;
-       argc->refcount = 0;
 
        if (PG(register_globals) || SG(request_info).argc) {
                arr->refcount++;
@@ -492,6 +488,8 @@
                zend_hash_update(Z_ARRVAL_P(track_vars_array), "argv", 
sizeof("argv"), &arr, sizeof(zval *), NULL);
                zend_hash_update(Z_ARRVAL_P(track_vars_array), "argc", 
sizeof("argc"), &argc, sizeof(zval *), NULL);
        }
+       zval_ptr_dtor(&arr);
+       zval_ptr_dtor(&argc);
 }
 /* }}} */
 

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

Reply via email to