summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2016-03-04 10:12:43 -0700
committerKarl Williamson <khw@cpan.org>2016-03-04 12:04:20 -0700
commitabe1abcfb267758acc51af14494e2e293b2fd873 (patch)
treed03379a6d8682bd46a91fdc9032e976afb8be59d
parent54bc7615b0821ef5fe85ec08e2ba9cc2c5c7c1e5 (diff)
downloadperl-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.
-rw-r--r--locale.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/locale.c b/locale.c
index 0a2669f114..20e5e982f7 100644
--- a/locale.c
+++ b/locale.c
@@ -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