RFR: 8282628: Potential memory leak in sun.font.FontConfigManager.getFontConfig() [v2]

Alexey Ivanov aivanov at openjdk.java.net
Tue Mar 8 21:01:10 UTC 2022


On Tue, 8 Mar 2022 20:12:29 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> Can `SetObjectElementArray` raise an exception?  
>> The index is within the array length and we store a string. I assume `cacheDirArray` is a string array.
>
>> ??? 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?

-------------

PR: https://git.openjdk.java.net/jdk/pull/7691


More information about the core-libs-dev mailing list