On Wed, 5 Aug 2026 15:05:20 GMT, Matthias Baesken <[email protected]> wrote:

>> GlobalLock has a return value that indicates errors; this should be handled.
>> 
>> While looking into this, in Java_sun_awt_windows_WPrinterJob_deviceStartPage 
>>  a free call was found that is not placed correctly and can lead to leaks.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Matthias Baesken has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   awt_ClipBoard handle failing GlobalLock differently

Seems there is some issue with this GlobalUnlock call

            jbyte *pFileListWithDoubleZeroTerminator = (jbyte 
*)::GlobalLock(glob);
            if (pFileListWithDoubleZeroTerminator == NULL) {
                OLE_HRT(E_INVALIDARG);
            }
            env->SetByteArrayRegion(bytes, 0, st.cbSize.LowPart, 
pFileListWithDoubleZeroTerminator);
            ::GlobalUnlock(pFileListWithDoubleZeroTerminator);


Shouldn't GlobalUnlock be called on the handle (glob) and NOT on the pointer 
(`pFileListWithDoubleZeroTerminator` ) ?

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

PR Comment: https://git.openjdk.org/jdk/pull/32206#issuecomment-5193585026

Reply via email to