# HG changeset patch # User mbaesken # Date 1537967760 -7200 # Wed Sep 26 15:16:00 2018 +0200 # Node ID 9a7bf249dc55d4028326242a62d2587bc0d02695 # Parent 5f931e3e7a63b550d832d2624db32033b875c720 8211149: fix potential memleak in getJavaIDFromLangID after failing SetupI18nProps call [windows] diff --git a/src/java.base/windows/native/libjava/java_props_md.c b/src/java.base/windows/native/libjava/java_props_md.c --- a/src/java.base/windows/native/libjava/java_props_md.c +++ b/src/java.base/windows/native/libjava/java_props_md.c @@ -170,6 +170,10 @@ 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]))) { @@ -188,6 +192,9 @@ free(elems[index]); } } else { + for (index = 0; index < 5; index++) { + if (elems[index] != NULL) { free(elems[index]); } + } free(ret); ret = NULL; }