ICU-1962 Don't do malloc(0), which returns NULL on some platforms.

new[0] will always return a pointer.

X-SVN-Rev: 9229
This commit is contained in:
George Rhoten 2002-07-17 16:58:32 +00:00
parent 35b7aab4d6
commit 4a15917960

View file

@ -317,6 +317,12 @@ void TransliterationRuleSet::freeze(UParseError& parseError,UErrorCode& status)
/* Freeze things into an array.
*/
uprv_free(rules); // Contains alias pointers
/* You can't do malloc(0)! */
if (v.size() == 0) {
rules = NULL;
return;
}
rules = (TransliterationRule **)uprv_malloc(v.size() * sizeof(TransliterationRule *));
/* test for NULL */
if (rules == 0) {