RFR: 8284680: sun.font.FontConfigManager.getFontConfig() leaks charset
Andrew John Hughes
andrew at openjdk.java.net
Wed May 4 01:43:24 UTC 2022
On Thu, 28 Apr 2022 20:12:52 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:
> >
>
> Hmmm, you are right. Phil probably pointed out the same problem, but I misunderstood it.
>
> What's odd is that, I tested (made sure that `FcCharSetDestroy` indeed called), it did not crash and `valgrind` showed the leak site disappeared.
>
> With your suggested fix, I think we still leak last `unionCharset`. BTW, the API documentation is really unhelpful, Sigh!
That's fixed by your addition at the end, right?
I assumed the final unionCharset was used for something, but it never seems to actually be read, just continually added to and then drops out of scope.
It may also need to be freed in the `if (result != FcResultMatch) {` block which frees everything else and returns from within the inner loop.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8187
More information about the client-libs-dev
mailing list