dmitry                                   Mon, 21 Sep 2009 11:22:13 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=288518

Log:
Fixed memory leak

Changed paths:
    U   php/php-src/branches/PHP_5_2/main/output.c
    U   php/php-src/branches/PHP_5_3/main/output.c

Modified: php/php-src/branches/PHP_5_2/main/output.c
===================================================================
--- php/php-src/branches/PHP_5_2/main/output.c  2009-09-21 10:16:44 UTC (rev 
288517)
+++ php/php-src/branches/PHP_5_2/main/output.c  2009-09-21 11:22:13 UTC (rev 
288518)
@@ -227,8 +227,6 @@

                ALLOC_INIT_ZVAL(orig_buffer);
                ZVAL_STRINGL(orig_buffer, OG(active_ob_buffer).buffer, 
OG(active_ob_buffer).text_length, 1);
-               orig_buffer->refcount=2;        /* don't let 
call_user_function() destroy our buffer */
-               orig_buffer->is_ref=1;

                ALLOC_INIT_ZVAL(z_status);
                ZVAL_LONG(z_status, status);
@@ -248,11 +246,7 @@
                if (!just_flush) {
                        zval_ptr_dtor(&OG(active_ob_buffer).output_handler);
                }
-               orig_buffer->refcount -=2;
-               if (orig_buffer->refcount <= 0) { /* free the zval */
-                       zval_dtor(orig_buffer);
-                       FREE_ZVAL(orig_buffer);
-               }
+               zval_ptr_dtor(&orig_buffer);
                zval_ptr_dtor(&z_status);
        }


Modified: php/php-src/branches/PHP_5_3/main/output.c
===================================================================
--- php/php-src/branches/PHP_5_3/main/output.c  2009-09-21 10:16:44 UTC (rev 
288517)
+++ php/php-src/branches/PHP_5_3/main/output.c  2009-09-21 11:22:13 UTC (rev 
288518)
@@ -227,8 +227,6 @@

                ALLOC_INIT_ZVAL(orig_buffer);
                ZVAL_STRINGL(orig_buffer, OG(active_ob_buffer).buffer, 
OG(active_ob_buffer).text_length, 1);
-               Z_SET_REFCOUNT_P(orig_buffer, 2);       /* don't let 
call_user_function() destroy our buffer */
-               Z_SET_ISREF_P(orig_buffer);

                ALLOC_INIT_ZVAL(z_status);
                ZVAL_LONG(z_status, status);
@@ -248,11 +246,7 @@
                if (!just_flush) {
                        zval_ptr_dtor(&OG(active_ob_buffer).output_handler);
                }
-               Z_SET_REFCOUNT_P(orig_buffer, Z_REFCOUNT_P(orig_buffer) - 2);
-               if (Z_REFCOUNT_P(orig_buffer) <= 0) { /* free the zval */
-                       zval_dtor(orig_buffer);
-                       FREE_ZVAL(orig_buffer);
-               }
+               zval_ptr_dtor(&orig_buffer);
                zval_ptr_dtor(&z_status);
        }


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

Reply via email to