diff options
author | Karl Williamson <khw@cpan.org> | 2016-03-04 10:12:43 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2016-03-04 12:04:20 -0700 |
commit | abe1abcfb267758acc51af14494e2e293b2fd873 (patch) | |
tree | d03379a6d8682bd46a91fdc9032e976afb8be59d /locale.c | |
parent | 54bc7615b0821ef5fe85ec08e2ba9cc2c5c7c1e5 (diff) | |
download | perl-abe1abcfb267758acc51af14494e2e293b2fd873.tar.gz |
locale.c: Avoid a leak
This reorders things to allow a free to be done. The cause was spotted
by Tony Cook.
Diffstat (limited to 'locale.c')
-rw-r--r-- | locale.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -190,13 +190,17 @@ Perl_new_numeric(pTHX_ const char *newnum) } save_newnum = stdize_locale(savepv(newnum)); + + PL_numeric_standard = isNAME_C_OR_POSIX(save_newnum); + PL_numeric_local = TRUE; + if (! PL_numeric_name || strNE(PL_numeric_name, save_newnum)) { Safefree(PL_numeric_name); PL_numeric_name = save_newnum; } - - PL_numeric_standard = isNAME_C_OR_POSIX(save_newnum); - PL_numeric_local = TRUE; + else { + Safefree(save_newnum); + } /* Keep LC_NUMERIC in the C locale. This is for XS modules, so they don't * have to worry about the radix being a non-dot. (Core operations that |