changeset 51014:01e4ddc3c23f

8203324: Use out of scope in getMacOSXLocale of java_props_macosx.c:120 Reviewed-by: rriggs
author naoto
date Tue, 05 Jun 2018 08:33:40 -0700
parents 76bca6678913
children 3d658c910e83
files src/java.base/macosx/native/libjava/java_props_macosx.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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);