On Wed, 4 May 2022 01:39:49 GMT, Andrew John Hughes <and...@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.

`                if ((*FcCharSetSubtractCount)(charset, unionCharset)
                    > minGlyphs) {
`
Seems this is the only use of unionCharset.

> 
> It may also need to be freed in the `if (result != FcResultMatch) {` block 
> which frees everything else and returns from within the inner loop.

Right, updated.

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

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

Reply via email to