This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix leak when $LANG unset
authorDavid Mitchell <davem@iabyn.com>
Tue, 16 Apr 2019 15:49:47 +0000 (16:49 +0100)
committerDavid Mitchell <davem@iabyn.com>
Tue, 16 Apr 2019 15:49:47 +0000 (16:49 +0100)
commit207cc8dfc710475ee7d8b4dd64a522bd1cf442d3
tree1a6cda11a18bc9ad7eac29a27273e7f72d9f414a
parent2bfe2a2773c59588ac2bf11b5d9439c92d86fb62
fix leak when $LANG unset

The following leaked:

    LANG=  perl -e1

because in S_emulate_setlocale(), it was
1) making a copy of $ENV{"LANG"};
2) throwing that copy away and replacing it with "C" when it discovered
   that the string was empty.

A little judicious reordering of that chunk of code makes the issue go
away.

Showed up as failures of lib/locale_threads.t under valgrind / ASan.
locale.c