RFR: 8284680: sun.font.FontConfigManager.getFontConfig() leaks charset
Zhengyu Gu
zgu at openjdk.java.net
Mon Apr 18 19:20:33 UTC 2022
On Fri, 15 Apr 2022 18:43:27 GMT, Phil Race <prr 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.
Right, that is why I have `if (currentUnionSet != charset)` check to prevent from freeing original `charset`.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8187
More information about the client-libs-dev
mailing list