Skip to content

Commit 5febb67

Browse files
committed
8361959: [GCC static analyzer] java_props_md.c leak of 'temp' variable is reported
Backport-of: bf225c201f00f3a478b51c3cf045759b66899684
1 parent fd2eea4 commit 5febb67

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/java.base/unix/native/libjava/java_props_md.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ static int ParseLocale(JNIEnv* env, int cat, char ** std_language, char ** std_s
239239
if (language != NULL && mapLookup(language_names, language, std_language) == 0) {
240240
*std_language = malloc(strlen(language)+1);
241241
if (*std_language == NULL) {
242+
free(temp);
242243
free(encoding_variant);
243244
JNU_ThrowOutOfMemoryError(env, NULL);
244245
return 0;
@@ -252,6 +253,7 @@ static int ParseLocale(JNIEnv* env, int cat, char ** std_language, char ** std_s
252253
if (mapLookup(country_names, country, std_country) == 0) {
253254
*std_country = malloc(strlen(country)+1);
254255
if (*std_country == NULL) {
256+
free(temp);
255257
free(encoding_variant);
256258
JNU_ThrowOutOfMemoryError(env, NULL);
257259
return 0;

0 commit comments

Comments
 (0)