summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2022-09-29 09:49:40 -0600
committerKarl Williamson <khw@cpan.org>2022-10-18 06:22:16 -0600
commit7af2d2037375d58e700f9e1b217efb2c4db66133 (patch)
tree4bb201f69d074041c49857b13164913ea88b119c
parent49825ce8d49ec49e0c08ecb341ea5a7b7383225b (diff)
downloadperl-7af2d2037375d58e700f9e1b217efb2c4db66133.tar.gz
locale.c: Do uselocale() earlier in init process
This prevents some unnecessary steps, that the next commit would turn into memory leaks.
-rw-r--r--locale.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/locale.c b/locale.c
index 09e4de0be4..94a64c8cdd 100644
--- a/locale.c
+++ b/locale.c
@@ -4790,6 +4790,11 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
DEBUG_Lv(PerlIO_printf(Perl_debug_log, "created C object %p\n",
PL_C_locale_obj));
+ /* Switch to using the POSIX 2008 interface now. This would happen below
+ * anyway, but deferring it can lead to leaks of memory that would also get
+ * malloc'd in the interim */
+ uselocale(PL_C_locale_obj);
+
# ifdef USE_LOCALE_NUMERIC
PL_underlying_numeric_obj = duplocale(PL_C_locale_obj);