mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
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:
parent
35b7aab4d6
commit
4a15917960
1 changed files with 6 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue