]> granicus.if.org Git - php/commitdiff
Fixed memory leak
authorDmitry Stogov <dmitry@php.net>
Mon, 21 Sep 2009 11:22:13 +0000 (11:22 +0000)
committerDmitry Stogov <dmitry@php.net>
Mon, 21 Sep 2009 11:22:13 +0000 (11:22 +0000)
main/output.c

index 1efaf806e720057dbb47f533b9eb42b74a7babe3..fdf7ac4a322f868da97fa8223e292f9bfdfead26 100644 (file)
@@ -227,8 +227,6 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS
 
                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 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS
                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);
        }