This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix locale leaks on utf8 strings
For example the following leaked:
require POSIX; import POSIX ':locale_h';
setlocale(&POSIX::LC_ALL, 'aa_DJ.iso88591') or die;
use locale;
my $ok = 'A' lt chr 0x100;
Some code in Perl__mem_collxfrm() does a couple of
for (j = 1; j < 256; j++) { ... }
loops where for each chr(j) character it recursively calls itself, and
records the index of the 'smallest' / 'largest' result. However, when
updating cur_min_x / cur_max_x, it wasn't freeing the previous value.
The symptoms were that valgrind / Address Sanitizer found fault with
lib/locale.t