RFR: 8284680: sun.font.FontConfigManager.getFontConfig() leaks charset

Phil Race prr at openjdk.java.net
Fri Apr 15 18:46:40 UTC 2022


On Mon, 11 Apr 2022 18:05:09 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

> Please review this small patch that releases temporary charsets to avoid memory leak.
> 
> Test:
> 
> - [x] jdk_2d

src/java.desktop/unix/native/common/awt/fontpath.c line 1112:

> 1110:                     if (currentUnionSet != charset) {
> 1111:                         (*FcCharSetDestroy)(currentUnionSet);
> 1112:                     }

Hmm. I worry that you may be replacing a leak with a crash.
The original "charset" was returned from FcPatternGetCharSet() and I don't think it was a copy and will be freed when the pattern is destroyed.
So that should not be freed here.

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

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



More information about the client-libs-dev mailing list