Re: [PHP-DEV] Memory Leak in ob_get_clean() / ob_get_flush ()
Hi, Did this get addressed yet? regards, Lukas On 18.03.2009, at 03:15, Christian Seiler wrote: Hi, When running 'make test' on my system I discovered that tests/output/ob_start_basic_unerasable_003.phpt and tests/output/ob_start_basic_unerasable_004.phpt produced memory leaks - due to the fact that they first fetch the buffer into return_value but then do RETURN_FALSE if they detect an error and thus leak the copied buffer. I attached a patch that fixes that to this mail. Any objections to me applying this for 5.3 and HEAD? (after 5.3 RC1 when commits are allowed again of course) Any side-effects I didn't think about? Regards, Christian Index: main/output.c === RCS file: /repository/php-src/main/output.c,v retrieving revision 1.167.2.3.2.4.2.12 diff -u -p -r1.167.2.3.2.4.2.12 output.c --- main/output.c 13 Feb 2009 11:48:17 - 1.167.2.3.2.4.2.12 +++ main/output.c 18 Mar 2009 02:09:13 - @@ -867,10 +867,12 @@ PHP_FUNCTION(ob_get_flush) /* error checks */ if (!OG(ob_nesting_level)) { php_error_docref(ref.outcontrol TSRMLS_CC, E_NOTICE, failed to delete and flush buffer. No buffer to delete or flush.); + zval_dtor(return_value); RETURN_FALSE; } if (OG(ob_nesting_level) !OG(active_ob_buffer).status ! OG(active_ob_buffer).erase) { php_error_docref(ref.outcontrol TSRMLS_CC, E_NOTICE, failed to delete buffer %s., OG(active_ob_buffer).handler_name); + zval_dtor(return_value); RETURN_FALSE; } /* flush */ @@ -892,10 +894,12 @@ PHP_FUNCTION(ob_get_clean) /* error checks */ if (!OG(ob_nesting_level)) { php_error_docref(ref.outcontrol TSRMLS_CC, E_NOTICE, failed to delete buffer. No buffer to delete.); + zval_dtor(return_value); RETURN_FALSE; } if (OG(ob_nesting_level) !OG(active_ob_buffer).status ! OG(active_ob_buffer).erase) { php_error_docref(ref.outcontrol TSRMLS_CC, E_NOTICE, failed to delete buffer %s., OG(active_ob_buffer).handler_name); + zval_dtor(return_value); RETURN_FALSE; } /* delete buffer */ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php Lukas Kahwe Smith m...@pooteeweet.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Memory Leak in ob_get_clean() / ob_get_flush ()
Hi Lukas, Did this get addressed yet? No, it didn't. But since no one complained about it I'll commit it later this evening. (commit freeze is over, right?) Regards, Christian -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Memory Leak in ob_get_clean() / ob_get_flush ()
Hi Christian 2009/3/25 Christian Seiler chris...@gmx.net: Hi Lukas, Did this get addressed yet? No, it didn't. But since no one complained about it I'll commit it later this evening. (commit freeze is over, right?) Yes commit freeze is over, RC1 was tagged in CVS the other day and released yesterday. Regards, Christian -- Kalle Sommer Nielsen ka...@php.net -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Memory Leak in ob_get_clean() / ob_get_flush ()
Hi, When running 'make test' on my system I discovered that tests/output/ob_start_basic_unerasable_003.phpt and tests/output/ob_start_basic_unerasable_004.phpt produced memory leaks - due to the fact that they first fetch the buffer into return_value but then do RETURN_FALSE if they detect an error and thus leak the copied buffer. I attached a patch that fixes that to this mail. Any objections to me applying this for 5.3 and HEAD? (after 5.3 RC1 when commits are allowed again of course) Any side-effects I didn't think about? Regards, Christian Index: main/output.c === RCS file: /repository/php-src/main/output.c,v retrieving revision 1.167.2.3.2.4.2.12 diff -u -p -r1.167.2.3.2.4.2.12 output.c --- main/output.c 13 Feb 2009 11:48:17 - 1.167.2.3.2.4.2.12 +++ main/output.c 18 Mar 2009 02:09:13 - @@ -867,10 +867,12 @@ PHP_FUNCTION(ob_get_flush) /* error checks */ if (!OG(ob_nesting_level)) { php_error_docref(ref.outcontrol TSRMLS_CC, E_NOTICE, failed to delete and flush buffer. No buffer to delete or flush.); + zval_dtor(return_value); RETURN_FALSE; } if (OG(ob_nesting_level) !OG(active_ob_buffer).status !OG(active_ob_buffer).erase) { php_error_docref(ref.outcontrol TSRMLS_CC, E_NOTICE, failed to delete buffer %s., OG(active_ob_buffer).handler_name); + zval_dtor(return_value); RETURN_FALSE; } /* flush */ @@ -892,10 +894,12 @@ PHP_FUNCTION(ob_get_clean) /* error checks */ if (!OG(ob_nesting_level)) { php_error_docref(ref.outcontrol TSRMLS_CC, E_NOTICE, failed to delete buffer. No buffer to delete.); + zval_dtor(return_value); RETURN_FALSE; } if (OG(ob_nesting_level) !OG(active_ob_buffer).status !OG(active_ob_buffer).erase) { php_error_docref(ref.outcontrol TSRMLS_CC, E_NOTICE, failed to delete buffer %s., OG(active_ob_buffer).handler_name); + zval_dtor(return_value); RETURN_FALSE; } /* delete buffer */ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php