8203324: Use out of scope in getMacOSXLocale of java_props_macosx.c:120
authornaoto
Tue, 05 Jun 2018 08:33:40 -0700
changeset 50410 01e4ddc3c23f
parent 50409 76bca6678913
child 50412 3d658c910e83
8203324: Use out of scope in getMacOSXLocale of java_props_macosx.c:120 Reviewed-by: rriggs
src/java.base/macosx/native/libjava/java_props_macosx.c
--- a/src/java.base/macosx/native/libjava/java_props_macosx.c	Tue Jun 05 11:11:33 2018 -0400
+++ b/src/java.base/macosx/native/libjava/java_props_macosx.c	Tue Jun 05 08:33:40 2018 -0700
@@ -47,6 +47,7 @@
 #define LOCALEIDLENGTH  128
 char *getMacOSXLocale(int cat) {
     const char* retVal = NULL;
+    char languageString[LOCALEIDLENGTH];
     char localeString[LOCALEIDLENGTH];
 
     switch (cat) {
@@ -67,7 +68,6 @@
                 CFRelease(languages);
                 return NULL;
             }
-            char languageString[LOCALEIDLENGTH];
             if (CFStringGetCString(primaryLanguage, languageString,
                                    LOCALEIDLENGTH, CFStringGetSystemEncoding()) == false) {
                 CFRelease(languages);