bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#52888: 29.0.50; font_{delete_unmatched,score} do not handle nil FONT


From: Robert Pluim
Subject: bug#52888: 29.0.50; font_{delete_unmatched,score} do not handle nil FONT_WEIGHT_INDEX
Date: Wed, 05 Jan 2022 14:55:02 +0100

>>>>> On Wed, 05 Jan 2022 14:37:56 +0200, Eli Zaretskii <eliz@gnu.org> said:

    Eli> I'm far from being an expert on Fontconfig programming, but the above
    Eli> use of 'range' looks strange: it's a pointer that starts pointing to
    Eli> some random (potentially invalid) address, and you pass its address to
    Eli> FcPatternGetRange, which presumably assigns to it a valid point.  But
    Eli> doesn't that valid pointer need to be released somehow after we use
    Eli> it?  Or does it point to static area(s)?  I cannot find anything in
    Eli> the Fontconfig documentation about the memory-management protocols for
    Eli> FcValue objects, but maybe we should call FcValueDestroy on it after
    Eli> we are done with it?  Or maybe this is not needed, as this passage
    Eli> from the docs says near the end:

    Eli>   void FcValueDestroy (FcValue v)
    Eli>       Frees any memory referenced by `v'. Values of type FcTypeString,
    Eli>       FcTypeMatrix and FcTypeCharSet reference memory, the other types
    Eli>       do not.

Based on an admittedly quick reading of the fontconfig code, itʼs not
our responsibility to deallocate the FcRange here; it ends up pointing
to memory previously allocated internally by fontconfig.

Robert
-- 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]