summaryrefslogtreecommitdiff
path: root/ext/mbstring
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-01-28 17:39:37 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-01-28 17:39:49 +0100
commit9fcaf25c93aed2f70343d9f092627570ff1946e3 (patch)
tree97331b94504d5f4b63cfc2d41b9eea65db935513 /ext/mbstring
parent8a5bc8c6be8e9ea5b7480a99f1e9b8c4bd6466e6 (diff)
downloadphp-git-9fcaf25c93aed2f70343d9f092627570ff1946e3.tar.gz
Fix memory leak in mb_str_split
Diffstat (limited to 'ext/mbstring')
-rw-r--r--ext/mbstring/mbstring.c1
-rw-r--r--ext/mbstring/tests/mb_str_split_utf8_utf16.phpt12
2 files changed, 11 insertions, 2 deletions
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index c0ba05cba3..78557e7f94 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -2461,6 +2461,7 @@ PHP_FUNCTION(mb_str_split)
mbfl_convert_filter_delete(decoder);
mbfl_convert_filter_delete(filter);
+ mbfl_memory_device_clear(&device);
return;
}
diff --git a/ext/mbstring/tests/mb_str_split_utf8_utf16.phpt b/ext/mbstring/tests/mb_str_split_utf8_utf16.phpt
index b8234bb322..d53dd088de 100644
--- a/ext/mbstring/tests/mb_str_split_utf8_utf16.phpt
+++ b/ext/mbstring/tests/mb_str_split_utf8_utf16.phpt
@@ -69,6 +69,10 @@ foreach(mb_str_split($utf16le_bad, 1, "UTF-16LE") as $chunk){
}
echo PHP_EOL;
+var_dump(mb_str_split("", 1, "ASCII"));
+var_dump(mb_str_split("", 1, "UTF-8"));
+var_dump(mb_str_split("", 1, "UTF-16LE"));
+
?>
--EXPECT--
UTF-8: l:2 v:3132 l:5 v:33f09280a9
@@ -77,5 +81,9 @@ UTF-16BE: l:4 v:d800dc00 l:4 v:dbffdfff
UTF-16LE: l:4 v:00d800dc l:4 v:ffdbffdf
BAD UTF-16BE: l:4 v:d800dc00 l:2 v:003f l:2 v:003f
BAD UTF-16LE: l:4 v:00d800dc l:2 v:3f00 l:2 v:3f00
-
-
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}