Commit d70568ea9f0 for php.net
commit d70568ea9f0d9f10e8bcd4fcddd8bfad9a58cb00
Author: Ilia Alshanetsky <ilia@ilia.ws>
Date: Sun Jun 7 16:52:28 2026 -0400
intl: Fix memory leak in IntlChar::getFC_NFKC_Closure()
Free the closure buffer before the UTF-8 conversion status check, which
returns early on failure.
Closes GH-22252
diff --git a/ext/intl/uchar/uchar.c b/ext/intl/uchar/uchar.c
index 4d3d424df79..f194e0e0b93 100644
--- a/ext/intl/uchar/uchar.c
+++ b/ext/intl/uchar/uchar.c
@@ -525,8 +525,8 @@ IC_METHOD(getFC_NFKC_Closure) {
error = U_ZERO_ERROR;
u8str = intl_convert_utf16_to_utf8(closure, closure_len, &error);
- INTL_CHECK_STATUS(error, "Failed converting output to UTF8");
efree(closure);
+ INTL_CHECK_STATUS(error, "Failed converting output to UTF8");
RETVAL_NEW_STR(u8str);
}
/* }}} */