On Tue, 8 Mar 2022 12:20:38 GMT, David Holmes <dhol...@openjdk.org> wrote:

>> src/java.desktop/unix/native/common/awt/fontpath.c line 940:
>> 
>>> 938:                 JNU_CHECK_EXCEPTION_AND_CLEANUP(env, 
>>> (*FcStrListDone)(cacheDirs));
>>> 939: 
>>> 940:                 (*env)->SetObjectArrayElement(env, cacheDirArray, 
>>> cnt++, jstr);
>> 
>> Probably we should add the check+cleanup after the SetObjectArrayElement? 
>> Otherwise, we may call NewStringUTF while an exception is raised by the 
>> SetObjectArrayElement.
>
> ??? You want to check and cleanup if NewStringUTF fails. You only want to 
> call SetObjectElementArray if NewStringUTF succeeds.

Can `SetObjectElementArray` raise an exception?  
The index is within the array length and we store a string. I assume 
`cacheDirArray` is a string array.

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

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

Reply via email to