Hi Stas,

I did run the test of bug #55871 and got memory leaks. This patch
remove them. Could you please review the patch and if it is Ok i'll
commit it to 5.4

Thanks
Pierrick
Index: NEWS
===================================================================
--- NEWS        (revision 322482)
+++ NEWS        (working copy)
@@ -2,6 +2,9 @@
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Jan 2012, PHP 5.4.0
 
+- Standard:
+  . Fixed memory leak in substr_replace. (Pierrick)
+
 19 Jan 2012, PHP 5.4.0 RC6
 
 - Core:
Index: ext/standard/string.c
===================================================================
--- ext/standard/string.c       (revision 322482)
+++ ext/standard/string.c       (working copy)
@@ -2518,6 +2518,9 @@
 
                                        if(Z_REFCOUNT_P(orig_str) != refcount) {
                                                php_error_docref(NULL 
TSRMLS_CC, E_WARNING, "Argument was modified while replacing");
+                                               if(Z_TYPE_PP(tmp_repl) != 
IS_STRING) {
+                                                       zval_dtor(repl_str);
+                                               }
                                                break;
                                        }
 
-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to