Skip to content

Commit 5df2a05

Browse files
committed
8282628: Potential memory leak in sun.font.FontConfigManager.getFontConfig()
Reviewed-by: stuefe, dholmes, aivanov
1 parent d07f7c7 commit 5df2a05

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/java.desktop/unix/native/common/awt/fontpath.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -935,8 +935,10 @@ Java_sun_font_FontConfigManager_getFontConfig
935935
if (cacheDirs != NULL) {
936936
while ((cnt < max) && (cacheDir = (*FcStrListNext)(cacheDirs))) {
937937
jstr = (*env)->NewStringUTF(env, (const char*)cacheDir);
938-
JNU_CHECK_EXCEPTION(env);
939-
938+
if (IS_NULL(jstr)) {
939+
(*FcStrListDone)(cacheDirs);
940+
return;
941+
}
940942
(*env)->SetObjectArrayElement(env, cacheDirArray, cnt++, jstr);
941943
(*env)->DeleteLocalRef(env, jstr);
942944
}

0 commit comments

Comments
 (0)