@@ -8601,6 +8601,8 @@ S_strftime8(pTHX_ const char * fmt,
8601
8601
8602
8602
#endif
8603
8603
8604
+ void * free_me = NULL ;
8605
+
8604
8606
switch (fmt_utf8ness ) {
8605
8607
case UTF8NESS_IMMATERIAL :
8606
8608
break ;
@@ -8619,15 +8621,12 @@ S_strftime8(pTHX_ const char * fmt,
8619
8621
if (! is_locale_utf8 (locale )) {
8620
8622
locale_utf8ness = LOCALE_NOT_UTF8 ;
8621
8623
8622
- bool is_utf8 = true;
8623
8624
Size_t fmt_len = strlen (fmt );
8624
- fmt = ( char * ) bytes_from_utf8 (( U8 * ) fmt , & fmt_len , & is_utf8 );
8625
- if ( is_utf8 ) {
8625
+ if (! utf8_to_bytes_new_pv (( const U8 * * ) & fmt , & fmt_len , & free_me ))
8626
+ {
8626
8627
SET_EINVAL ;
8627
8628
return false;
8628
8629
}
8629
-
8630
- SAVEFREEPV (fmt );
8631
8630
}
8632
8631
else {
8633
8632
locale_utf8ness = LOCALE_IS_UTF8 ;
@@ -8649,15 +8648,16 @@ S_strftime8(pTHX_ const char * fmt,
8649
8648
* locale would find any UTF-8 variant characters to be
8650
8649
* malformed */
8651
8650
Size_t fmt_len = strlen (fmt );
8652
- fmt = (char * ) bytes_to_utf8 ((U8 * ) fmt , & fmt_len );
8653
- SAVEFREEPV ( fmt );
8651
+ fmt = (char * ) bytes_to_utf8_free_me ((U8 * ) fmt ,
8652
+ & fmt_len , & free_me );
8654
8653
}
8655
8654
}
8656
8655
8657
8656
break ;
8658
8657
}
8659
8658
8660
8659
if (! strftime_tm (fmt , sv , locale , mytm )) {
8660
+ Safefree (free_me );
8661
8661
return false;
8662
8662
}
8663
8663
@@ -8672,6 +8672,7 @@ S_strftime8(pTHX_ const char * fmt,
8672
8672
? SvPVX (sv )
8673
8673
:_byte_dump_string ((U8 * ) SvPVX (sv ), SvCUR (sv ) ,0 )),
8674
8674
* result_utf8ness ));
8675
+ Safefree (free_me );
8675
8676
return true;
8676
8677
8677
8678
#undef INDEX_TO_USE
0 commit comments