mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8211149: fix potential memleak in getJavaIDFromLangID after failing SetupI18nProps call [windows]
Reviewed-by: naoto, lucy
This commit is contained in:
parent
36f62aa6c0
commit
f8d007dbf0
1 changed files with 10 additions and 4 deletions
|
@ -170,6 +170,10 @@ getJavaIDFromLangID(LANGID langID)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
for (index = 0; index < 5; index++) {
|
||||
elems[index] = NULL;
|
||||
}
|
||||
|
||||
if (SetupI18nProps(MAKELCID(langID, SORT_DEFAULT),
|
||||
&(elems[0]), &(elems[1]), &(elems[2]), &(elems[3]), &(elems[4]))) {
|
||||
|
||||
|
@ -183,15 +187,17 @@ getJavaIDFromLangID(LANGID langID)
|
|||
strcat(ret, elems[index]);
|
||||
}
|
||||
}
|
||||
|
||||
for (index = 0; index < 5; index++) {
|
||||
free(elems[index]);
|
||||
}
|
||||
} else {
|
||||
free(ret);
|
||||
ret = NULL;
|
||||
}
|
||||
|
||||
for (index = 0; index < 5; index++) {
|
||||
if (elems[index] != NULL) {
|
||||
free(elems[index]);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue