From 742f50123246f02db4806104e4d2f6a914cde2e9 Mon Sep 17 00:00:00 2001 From: Michael Ow Date: Thu, 30 Sep 2010 05:44:33 +0000 Subject: [PATCH] ICU-7983 Resolve valgrind error when calling Calendar::createInstance(). X-SVN-Rev: 28739 --- icu4c/source/i18n/calendar.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/icu4c/source/i18n/calendar.cpp b/icu4c/source/i18n/calendar.cpp index b09409d8355..af2936799eb 100644 --- a/icu4c/source/i18n/calendar.cpp +++ b/icu4c/source/i18n/calendar.cpp @@ -3250,14 +3250,15 @@ Calendar::setWeekData(const Locale& desiredLocale, const char *type, UErrorCode& // 2). If the locale has a script designation then we ignore it, // then remove it ( i.e. "en_Latn_US" becomes "en_US" ) - char minLocaleID[ULOC_FULLNAME_CAPACITY]; + char minLocaleID[ULOC_FULLNAME_CAPACITY] = { 0 }; UErrorCode myStatus = U_ZERO_ERROR; + uloc_minimizeSubtags(desiredLocale.getName(),minLocaleID,ULOC_FULLNAME_CAPACITY,&myStatus); Locale min = Locale::createFromName(minLocaleID); Locale useLocale; if ( uprv_strlen(desiredLocale.getCountry()) == 0 || uprv_strlen(desiredLocale.getScript()) > 0 && uprv_strlen(min.getScript()) == 0 ) { - char maxLocaleID[ULOC_FULLNAME_CAPACITY]; + char maxLocaleID[ULOC_FULLNAME_CAPACITY] = { 0 }; myStatus = U_ZERO_ERROR; uloc_addLikelySubtags(desiredLocale.getName(),maxLocaleID,ULOC_FULLNAME_CAPACITY,&myStatus); Locale max = Locale::createFromName(maxLocaleID);