Stuck with this one, ideas welcome:

On Wed, Nov 24, 2021 at 03:22:54PM +0100, Dominik Vogt wrote:
> ==8482== 38 (16 direct, 22 indirect) bytes in 1 blocks are definitely lost in 
> loss record 184 of 536
> ==8482==    at 0x48386AF: malloc (in 
> /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==8482==    by 0x483ADE7: realloc (in 
> /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==8482==    by 0x4CE950B: XCreateFontSet (in 
> /usr/lib/x86_64-linux-gnu/libX11.so.6.4.0)
> ==8482==    by 0x18EB64: FlocaleGetFontSet (Flocale.c:1152)
> ==8482==    by 0x18FD81: FlocaleGetFontOrFontSet (Flocale.c:1302)
> ==8482==    by 0x18FD81: FlocaleLoadFont (Flocale.c:1479)
> ==8482==    by 0x14A314: CMD_DefaultFont (builtins.c:3160)

This simple reduced test case still leaks memory:

        char **ml;
        int mc;
        char *ds;

        fontset = XCreateFontSet(dpy, fn_fixed, &ml, &mc, &ds);
        if (fontset)
        {
                if (ml) XFreeStringList(ml);
                XFreeFontSet(dpy, fontset);
        }

XFreeFontSet seems to not release all resources allocated by
XCreateFontSet.  It's not a one time leak; each Create/Free pair
leaks more memory.  It's not the "ml" bit which is always NULL.
ds always returns the same pointer, and it's not supposed to be
freed.

There's nothing in the net about memory leaks in XFreeFontSet.

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt

Reply via email to