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 -0000 1.167.2.3.2.4.2.12 +++ main/output.c 18 Mar 2009 02:09:13 -0000 @@ -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