1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix memleak on failure in collator_get_sort_key()

Closes GH-19138.
This commit is contained in:
Niels Dossche
2025-07-15 19:09:08 +02:00
parent a8086be81c
commit b495ce0371
2 changed files with 4 additions and 0 deletions

3
NEWS
View File

@@ -17,6 +17,9 @@ PHP NEWS
(nielsdos)
. Remove incorrect string release. (nielsdos)
- Intl:
. Fix memleak on failure in collator_get_sort_key(). (nielsdos)
- LDAP:
. Fixed GH-18902 ldap_exop/ldap_exop_sync assert triggered on empty
request OID. (David Carlier)

View File

@@ -556,6 +556,7 @@ PHP_FUNCTION( collator_get_sort_key )
key_len = ucol_getSortKey(co->ucoll, ustr, ustr_len, (uint8_t*)ZSTR_VAL(key_str), key_len);
efree( ustr );
if(!key_len) {
zend_string_efree(key_str);
RETURN_FALSE;
}
ZSTR_LEN(key_str) = key_len - 1;