RFR: 8282628: Potential memory leak in sun.font.FontConfigManager.getFontConfig() [v2]
Zhengyu Gu
zgu at openjdk.java.net
Tue Mar 8 21:05:09 UTC 2022
On Tue, 8 Mar 2022 20:57:27 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>>> ??? You want to check and cleanup if NewStringUTF fails. You only want to call SetObjectElementArray if NewStringUTF succeeds.
>>
>> If the SetObjectArrayElement will throw an exception we will call the NewStringUTF while the exception is raised which is a kind of "jni" issue. If such an exception is possible we should check and cleanup.
>
> A quick search for `SetObjectArrayElement` in `java.desktop` module shows the call to `SetObjectArrayElement` is rarely followed by exception check.
>
> What kind of exception can `SetObjectArrayElement` raise if the index is within the range and the stored element is of correct type?
I think `NewStringUTF()` can throw OOM and also return `NULL`, just which one you pick.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7691
More information about the core-libs-dev
mailing list