RFR: JDK-8313252: Java_sun_awt_windows_ThemeReader_paintBackground release resources in early returns

Matthias Baesken mbaesken at openjdk.org
Fri Jul 28 07:59:57 UTC 2023


In file ThemeReader.cpp functionJava_sun_awt_windows_ThemeReader_paintBackground
we create DCs and release them at the end, but seems we miss it in early returns.

While looking at the code, I noticed that CreateCompatibleDC can return NULL in case of error/failure, but we ignore this case; see 
https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-createcompatibledc   .
Should we better handle it or is it not really occurring in practise ?

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

Commit messages:
 - JDK-8313252

Changes: https://git.openjdk.org/jdk/pull/15064/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15064&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8313252
  Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/15064.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15064/head:pull/15064

PR: https://git.openjdk.org/jdk/pull/15064



More information about the client-libs-dev mailing list