mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-14 18:03:44 +00: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
@ -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…
x
Reference in New Issue
Block a user