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

Zhengyu Gu zgu at openjdk.java.net
Tue Mar 8 17:52:04 UTC 2022


On Tue, 8 Mar 2022 15:58:57 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

> > I did a quick grep, there are a few suspicious spots, e.g. [https://github.com/openjdk/jdk/blob/master/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp#L2711](url), I have yet take a close look.
> 
> It doesn't leak the icon handle here, it's assigned to the member of the object (probably `NULL`). Yet it's inconsistent: if an exception is expected from `CreateIconFromRaster` on the line above, why isn't it checked after `CreateIconFromRaster` is called on the following line?

I am not familiar with this code. What I see is that, it assigns `m_hIcon` and `m_hIconSm` to local variables, then reset them to `NULL`, once exception returns, are references to icon and small icon handles lost? and it will destroy icons as L2727 - 2732 do. But I may miss something.

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

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


More information about the core-libs-dev mailing list