dmitry          Tue Apr 18 06:58:54 2006 UTC

  Modified files:              
    /php-src/main       php_variables.c 
  Log:
  Fixed memory leaks
  
  
http://cvs.php.net/viewcvs.cgi/php-src/main/php_variables.c?r1=1.125&r2=1.126&diff_format=u
Index: php-src/main/php_variables.c
diff -u php-src/main/php_variables.c:1.125 php-src/main/php_variables.c:1.126
--- php-src/main/php_variables.c:1.125  Mon Apr 10 15:09:15 2006
+++ php-src/main/php_variables.c        Tue Apr 18 06:58:54 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_variables.c,v 1.125 2006/04/10 15:09:15 sniper Exp $ */
+/* $Id: php_variables.c,v 1.126 2006/04/18 06:58:54 dmitry Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -627,10 +627,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? */
@@ -670,15 +668,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 (SG(request_info).argc) {
                arr->refcount++;
@@ -692,6 +688,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