From 2de2f7dd058a035ae75c1d2c450c9aafac99bd93 Mon Sep 17 00:00:00 2001 From: stooke Date: Tue, 3 Sep 2019 06:45:03 +0100 Subject: [PATCH] 8203324: Use out of scope in getMacOSXLocale of java_props_macosx.c:120 Reviewed-by: shade, andrew --- src/solaris/native/java/lang/java_props_macosx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/solaris/native/java/lang/java_props_macosx.c b/src/solaris/native/java/lang/java_props_macosx.c index b11a4d001..ce656170c 100644 --- a/src/solaris/native/java/lang/java_props_macosx.c +++ b/src/solaris/native/java/lang/java_props_macosx.c @@ -47,6 +47,8 @@ char *getPosixLocale(int cat) { #define LOCALEIDLENGTH 128 char *getMacOSXLocale(int cat) { const char* retVal = NULL; + char languageString[LOCALEIDLENGTH]; + char localeString[LOCALEIDLENGTH]; switch (cat) { case LC_MESSAGES: @@ -66,7 +68,6 @@ char *getMacOSXLocale(int cat) { CFRelease(languages); return NULL; } - char languageString[LOCALEIDLENGTH]; if (CFStringGetCString(primaryLanguage, languageString, LOCALEIDLENGTH, CFStringGetSystemEncoding()) == false) { CFRelease(languages); @@ -81,7 +82,6 @@ char *getMacOSXLocale(int cat) { // from Portuguese in Portugal), but this is missing when using the // "Portuguese (Brazil)" language. // If language is "pt" and the current locale is pt_BR, return pt_BR. - char localeString[LOCALEIDLENGTH]; if (strcmp(retVal, "pt") == 0 && CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()), localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding()) && @@ -92,7 +92,6 @@ char *getMacOSXLocale(int cat) { break; default: { - char localeString[LOCALEIDLENGTH]; if (!CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()), localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding())) { return NULL; -- GitLab