]> granicus.if.org Git - php/commitdiff
Fixed memory leak in substr_replace
authorPierrick Charron <pierrick@php.net>
Thu, 1 Mar 2012 15:10:29 +0000 (15:10 +0000)
committerPierrick Charron <pierrick@php.net>
Thu, 1 Mar 2012 15:10:29 +0000 (15:10 +0000)
NEWS
ext/standard/string.c

diff --git a/NEWS b/NEWS
index f65b69b01a9c282e12703cea47524ea8a7034f3b..4c0bbe1345b1f076707cacc490dfb9922e5cab80 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,10 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2012, PHP 5.4.1 RC1
+
+- Standard:
+  . Fixed memory leak in substr_replace. (Pierrick)
+
 01 Mar 2012, PHP 5.4.0 
 
 - autoconf 2.59+ is now supported (and required) for generating the
index ef89b9050dc547f2dc9e0ac708bd05f7f7df9f2a..be574109f59556396b239fe18c0de8bcc12551b1 100644 (file)
@@ -2518,6 +2518,9 @@ PHP_FUNCTION(substr_replace)
 
                                        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;
                                        }