On Mon, 3 Aug 2026 07:25:25 GMT, Matthias Baesken <[email protected]> wrote:

>> That's a good point!
>> The documentation says 
>> https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-globallock
>> " If the function succeeds, the return value is a pointer to the first byte 
>> of the memory block. If the function fails, the return value is NULL."
>> 
>> So it can fail and better should be checked !
>
> Unfortunately we have quite a few code locations where we miss the NULL-check 
> of the return value
> 
> https://github.com/openjdk/jdk/blob/81c9ea0682c54beb82f6259104f266bbc57c2fd6/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.cpp#L916
> 
> https://github.com/openjdk/jdk/blob/81c9ea0682c54beb82f6259104f266bbc57c2fd6/src/java.desktop/windows/native/libawt/windows/awt_Clipboard.cpp#L247
> 
> https://github.com/openjdk/jdk/blob/81c9ea0682c54beb82f6259104f266bbc57c2fd6/src/java.desktop/windows/native/libawt/windows/awt_DataTransferer.cpp#L272
> 
> Should those be addressed to (maybe in another PR?) or is it just extremely 
> unlikely that the call fails?

I would not address them in this PR. They can be addressed in a single separate 
PR.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32151#discussion_r3707062445

Reply via email to