This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
locale.c: Move code to within only block using it
authorKarl Williamson <khw@cpan.org>
Sun, 26 Nov 2023 19:57:27 +0000 (12:57 -0700)
committerKarl Williamson <khw@cpan.org>
Fri, 8 Dec 2023 20:52:50 +0000 (13:52 -0700)
locale.c

index 7efb6a7..c46cd88 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -3434,15 +3434,15 @@ S_new_numeric(pTHX_ const char *newnum, bool force)
      * get this value, which doesn't appear to be used in any of the Microsoft
      * library routines anyway. */
 
-    char * scratch_buffer = NULL;
     if (PL_numeric_underlying_is_standard) {
+        char * scratch_buffer = NULL;
         PL_numeric_underlying_is_standard = strEQ(C_thousands_sep,
                                              my_langinfo_c(THOUSEP, LC_NUMERIC,
                                                            PL_numeric_name,
                                                            &scratch_buffer,
                                                            NULL, NULL));
+        Safefree(scratch_buffer);
     }
-    Safefree(scratch_buffer);
 
 #    endif