[vlc-commits] [Git][videolan/vlc][master] 4 commits: freetype: fontconfig: add missing end label

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Thu Oct 1 14:50:11 UTC 2026



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
67e60093 by Alexandre Janniaux at 2026-10-01T16:33:29+02:00
freetype: fontconfig: add missing end label

The label was missing from the previous refactor but it wasn't compiled
in CI and was merged too soon. I haven't investigated why it isn't
compiled though...

- - - - -
66db0029 by Alexandre Janniaux at 2026-10-01T16:33:29+02:00
freetype: fontconfig: fix leak on error path

- - - - -
762ac03a by Alexandre Janniaux at 2026-10-01T16:33:29+02:00
freetype: fontconfig: fix global memory leak

FcInitLoadConfigAndFonts() was called and creating a new FcConfig
because FcFontList()[^1] was called without a config, even though
FcInitLoadConfig() or FcInitLoadConfigAndFonts() was already called in
FontConfig_Prepare(). In the callstack below, we can see that the leak
is not actually coming from FontConfig_Prepare() which seemed
suspicious.

The module then leaked the lazily created config and only used the
FcConfig it created in FontConfig_Prepare.

[^1]: https://www.freedesktop.org/software/fontconfig/fontconfig-devel/fcfontlist.html

This commit fixes the leaks from the following report on version
strictly before 2.17.0 but new leaks are appearing starting with
version 2.17.0, that are fixed in the next commit.

Report from ASAN on 2.16:

    ==1825980==ERROR: LeakSanitizer: detected memory leaks

    Direct leak of 256 byte(s) in 1 object(s) allocated from:
        #0 0x7ffff7921c2b in malloc (/nix/store/ab3753m6i7isgvzphlar0a8xb84gl96i-gcc-15.2.0-lib/lib/libasan.so.8+0x121c2b)
        #1 0x7bffecfd6eec in FcPatternObjectInsertElt (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x27eec)
        #2 0x7bffecfd78a8 in FcPatternObjectAddWithBinding (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x288a8)
        #3 0x7bffecfd939f in FcPatternAppend (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x2a39f)
        #4 0x7bffecfe3720 in FcEndElement (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x34720)
        #5 0x7bffef2e7e28 in doContent (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0xfe28)
        #6 0x7bffef2e8c20 in contentProcessor (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0x10c20)
        #7 0x7bffef2e8e81 in doProlog (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0x10e81)
        #8 0x7bffef2eb43a in prologProcessor (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0x1343a)
        #9 0x7bffef2dcb9e in callProcessor.constprop.0 (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0x4b9e)
        #10 0x7bffef2e258a in XML_ParseBuffer (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0xa58a)
        #11 0x7bffecfe0031 in FcConfigParseAndLoadFromMemoryInternal (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x31031)
        #12 0x7bffecfe09a2 in _FcConfigParse (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x319a2)
        #13 0x7bffecfe0a05 in _FcConfigParse (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x31a05)
        #14 0x7bffecfe13b2 in FcEndElement (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x323b2)
        #15 0x7bffef2e7e28 in doContent (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0xfe28)
        #16 0x7bffef2e8c20 in contentProcessor (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0x10c20)
        #17 0x7bffef2e8e81 in doProlog (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0x10e81)
        #18 0x7bffef2eb43a in prologProcessor (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0x1343a)
        #19 0x7bffef2dcb9e in callProcessor.constprop.0 (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0x4b9e)
        #20 0x7bffef2e258a in XML_ParseBuffer (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0xa58a)
        #21 0x7bffecfe0031 in FcConfigParseAndLoadFromMemoryInternal (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x31031)
        #22 0x7bffecfe09a2 in _FcConfigParse (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x319a2)
        #23 0x7bffecfcdf16 in FcInitLoadOwnConfig (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x1ef16)
        #24 0x7bffecfce20f in IA__FcInitLoadConfigAndFonts (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x1f20f)
        #25 0x7bffecfbc88b in IA__FcConfigReference.part.0 (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0xd88b)
        #26 0x7bffecfce2ef in FcInitBringUptoDate (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x1f2ef)
        #27 0x7bffecfd1658 in IA__FcFontList (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x22658)
        #28 0x7bffea131097 in FontConfig_FillFaces ../modules/text_renderer/freetype/fonts/fontconfig.c:162
        #29 0x7bffea1317a1 in FontConfig_SelectAmongFamilies ../modules/text_renderer/freetype/fonts/fontconfig.c:249
        #30 0x7bffea120ad6 in FontSelectAmongFamilies ../modules/text_renderer/freetype/platform_fonts.c:986
        #31 0x7bffea11f593 in SelectFontWithFamilyFallback ../modules/text_renderer/freetype/platform_fonts.c:648
        #32 0x7bffea11fd94 in SelectAndLoadFace ../modules/text_renderer/freetype/platform_fonts.c:766
        #33 0x7bffea1189e2 in Render ../modules/text_renderer/freetype/freetype.c:1048
        #34 0x7ffff7468895 in SpuRenderText ../src/video_output/vout_subpictures.c:445
        #35 0x7ffff7476610 in spu_PrerenderText ../src/video_output/vout_subpictures.c:1784
        #36 0x7ffff74779e8 in spu_PrerenderThread ../src/video_output/vout_subpictures.c:1859
        #37 0x7ffff7863c75 in asan_thread_start(void*) (/nix/store/ab3753m6i7isgvzphlar0a8xb84gl96i-gcc-15.2.0-lib/lib/libasan.so.8+0x63c75)

    Indirect leak of 32 byte(s) in 1 object(s) allocated from:
        #0 0x7ffff79215a3 in calloc (/nix/store/ab3753m6i7isgvzphlar0a8xb84gl96i-gcc-15.2.0-lib/lib/libasan.so.8+0x1215a3)
        #1 0x7bffecfd783a in FcPatternObjectAddWithBinding (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x2883a)
        #2 0x7bffecfd939f in FcPatternAppend (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x2a39f)
        #3 0x7bffecfe3720 in FcEndElement (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x34720)
        #4 0x7bffef2e7e28 in doContent (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0xfe28)
        #5 0x7bffef2e8c20 in contentProcessor (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0x10c20)
        #6 0x7bffef2e8e81 in doProlog (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0x10e81)
        #7 0x7bffef2eb43a in prologProcessor (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0x1343a)
        #8 0x7bffef2dcb9e in callProcessor.constprop.0 (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0x4b9e)
        #9 0x7bffef2e258a in XML_ParseBuffer (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0xa58a)
        #10 0x7bffecfe0031 in FcConfigParseAndLoadFromMemoryInternal (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x31031)
        #11 0x7bffecfe09a2 in _FcConfigParse (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x319a2)
        #12 0x7bffecfe0a05 in _FcConfigParse (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x31a05)
        #13 0x7bffecfe13b2 in FcEndElement (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x323b2)
        #14 0x7bffef2e7e28 in doContent (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0xfe28)
        #15 0x7bffef2e8c20 in contentProcessor (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0x10c20)
        #16 0x7bffef2e8e81 in doProlog (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0x10e81)
        #17 0x7bffef2eb43a in prologProcessor (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0x1343a)
        #18 0x7bffef2dcb9e in callProcessor.constprop.0 (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0x4b9e)
        #19 0x7bffef2e258a in XML_ParseBuffer (/nix/store/91hg1nrgzxci4bbiwjnqw7x8lgwqy1n0-expat-2.8.2/lib/libexpat.so.1+0xa58a)
        #20 0x7bffecfe0031 in FcConfigParseAndLoadFromMemoryInternal (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x31031)
        #21 0x7bffecfe09a2 in _FcConfigParse (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x319a2)
        #22 0x7bffecfcdf16 in FcInitLoadOwnConfig (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x1ef16)
        #23 0x7bffecfce20f in IA__FcInitLoadConfigAndFonts (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x1f20f)
        #24 0x7bffecfbc88b in IA__FcConfigReference.part.0 (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0xd88b)
        #25 0x7bffecfce2ef in FcInitBringUptoDate (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x1f2ef)
        #26 0x7bffecfd1658 in IA__FcFontList (/nix/store/5j41zbrs4zsdiwqk1kxagqx2p70b3k51-fontconfig-2.16.2-lib/lib/libfontconfig.so.1+0x22658)
        #27 0x7bffea131097 in FontConfig_FillFaces ../modules/text_renderer/freetype/fonts/fontconfig.c:162
        #28 0x7bffea1317a1 in FontConfig_SelectAmongFamilies ../modules/text_renderer/freetype/fonts/fontconfig.c:249
        #29 0x7bffea120ad6 in FontSelectAmongFamilies ../modules/text_renderer/freetype/platform_fonts.c:986
        #30 0x7bffea11f593 in SelectFontWithFamilyFallback ../modules/text_renderer/freetype/platform_fonts.c:648
        #31 0x7bffea11fd94 in SelectAndLo
- - - - -
bdf90112 by Alexandre Janniaux at 2026-10-01T16:33:29+02:00
freetype: fontconfig: use FcConfigSetDefaultSubstitute()

Since fontconfig 2.17.0, FcDefaultSubstitute() is calling directly
FcConfigSetDefaultSubstitute(NULL, pattern). This leads to the creation
of the lazily created FcConfig via FcInitLoadConfigAndFonts().

Before 2.17.0, fontconfig was automatically using global variables for
this so the problem didn't appear.

Use FcConfigSetDefaultSubstitute() with the module configuration when
available, and keep FcDefaultSubstitute() for older versions. This might
keep the leak alive when updating the library without recompiling though.

We should never use a global FcConfig in our code. See upstream commit
https://gitlab.freedesktop.org/fontconfig/fontconfig/-/commit/90a84c477c4006b5539973a5487f28b3ed09711d

Report from asan on 2.17.1:

    ==1739517==ERROR: LeakSanitizer: detected memory leaks

    Direct leak of 256 byte(s) in 1 object(s) allocated from:
        #0 0x7ffff7921c2b in malloc (/nix/store/ab3753m6i7isgvzphlar0a8xb84gl96i-gcc-15.2.0-lib/lib/libasan.so.8+0x121c2b)
        #1 0x7bffe5c31516 in FcPatternObjectInsertElt (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x28516)
        #2 0x7bffe5c31f28 in FcPatternObjectAddWithBinding (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x28f28)
        #3 0x7bffe5c33aff in FcPatternAppend (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x2aaff)
        #4 0x7bffe5c3dc43 in FcEndElement (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x34c43)
        #5 0x7bffe4be6ae4 in doContent (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0xfae4)
        #6 0x7bffe4be7a90 in contentProcessor (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0x10a90)
        #7 0x7bffe4be7c9b in doProlog (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0x10c9b)
        #8 0x7bffe4bea41a in prologProcessor (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0x1341a)
        #9 0x7bffe4bdb7fe in callProcessor.constprop.0 (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0x47fe)
        #10 0x7bffe4be12cf in XML_ParseBuffer (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0xa2cf)
        #11 0x7bffe5c3a221 in FcConfigParseAndLoadFromMemoryInternal (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x31221)
        #12 0x7bffe5c3ab92 in _FcConfigParse (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x31b92)
        #13 0x7bffe5c3abf5 in _FcConfigParse (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x31bf5)
        #14 0x7bffe5c3b8f4 in FcEndElement (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x328f4)
        #15 0x7bffe4be6ae4 in doContent (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0xfae4)
        #16 0x7bffe4be7a90 in contentProcessor (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0x10a90)
        #17 0x7bffe4be7c9b in doProlog (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0x10c9b)
        #18 0x7bffe4bea41a in prologProcessor (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0x1341a)
        #19 0x7bffe4bdb7fe in callProcessor.constprop.0 (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0x47fe)
        #20 0x7bffe4be12cf in XML_ParseBuffer (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0xa2cf)
        #21 0x7bffe5c3a221 in FcConfigParseAndLoadFromMemoryInternal (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x31221)
        #22 0x7bffe5c3ab92 in _FcConfigParse (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x31b92)
        #23 0x7bffe5c28436 in FcInitLoadOwnConfig (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x1f436)
        #24 0x7bffe5c2872f in IA__FcInitLoadConfigAndFonts (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x1f72f)
        #25 0x7bffe5c16af9 in IA__FcConfigReference.part.0 (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0xdaf9)
        #26 0x7bffe5c1fb75 in IA__FcConfigSetDefaultSubstitute (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x16b75)
        #27 0x7bffdb51fcd4 in FontConfig_SelectAmongFamilies ../modules/text_renderer/freetype/fonts/fontconfig.c:207
        #28 0x7bffdb500ffc in FontSelectAmongFamilies ../modules/text_renderer/freetype/platform_fonts.c:986
        #29 0x7bffdb501b1f in SelectFontWithFamilyFallback ../modules/text_renderer/freetype/platform_fonts.c:648

    Indirect leak of 32 byte(s) in 1 object(s) allocated from:
        #0 0x7ffff79215a3 in calloc (/nix/store/ab3753m6i7isgvzphlar0a8xb84gl96i-gcc-15.2.0-lib/lib/libasan.so.8+0x1215a3)
        #1 0x7bffe5c31eba in FcPatternObjectAddWithBinding (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x28eba)
        #2 0x7bffe5c33aff in FcPatternAppend (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x2aaff)
        #3 0x7bffe5c3dc43 in FcEndElement (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x34c43)
        #4 0x7bffe4be6ae4 in doContent (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0xfae4)
        #5 0x7bffe4be7a90 in contentProcessor (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0x10a90)
        #6 0x7bffe4be7c9b in doProlog (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0x10c9b)
        #7 0x7bffe4bea41a in prologProcessor (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0x1341a)
        #8 0x7bffe4bdb7fe in callProcessor.constprop.0 (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0x47fe)
        #9 0x7bffe4be12cf in XML_ParseBuffer (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0xa2cf)
        #10 0x7bffe5c3a221 in FcConfigParseAndLoadFromMemoryInternal (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x31221)
        #11 0x7bffe5c3ab92 in _FcConfigParse (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x31b92)
        #12 0x7bffe5c3abf5 in _FcConfigParse (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x31bf5)
        #13 0x7bffe5c3b8f4 in FcEndElement (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x328f4)
        #14 0x7bffe4be6ae4 in doContent (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0xfae4)
        #15 0x7bffe4be7a90 in contentProcessor (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0x10a90)
        #16 0x7bffe4be7c9b in doProlog (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0x10c9b)
        #17 0x7bffe4bea41a in prologProcessor (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0x1341a)
        #18 0x7bffe4bdb7fe in callProcessor.constprop.0 (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0x47fe)
        #19 0x7bffe4be12cf in XML_ParseBuffer (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0xa2cf)
        #20 0x7bffe5c3a221 in FcConfigParseAndLoadFromMemoryInternal (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x31221)
        #21 0x7bffe5c3ab92 in _FcConfigParse (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x31b92)
        #22 0x7bffe5c28436 in FcInitLoadOwnConfig (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x1f436)
        #23 0x7bffe5c2872f in IA__FcInitLoadConfigAndFonts (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x1f72f)
        #24 0x7bffe5c16af9 in IA__FcConfigReference.part.0 (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0xdaf9)
        #25 0x7bffe5c1fb75 in IA__FcConfigSetDefaultSubstitute (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x16b75)
        #26 0x7bffdb51fcd4 in FontConfig_SelectAmongFamilies ../modules/text_renderer/freetype/fonts/fontconfig.c:207
        #27 0x7bffdb500ffc in FontSelectAmongFamilies ../modules/text_renderer/freetype/platform_fonts.c:986
        #28 0x7bffdb501b1f in SelectFontWithFamilyFallback ../modules/text_renderer/freetype/platform_fonts.c:648
        #29 0x7bffdb50230b in SelectAndLoadFace ../modules/text_renderer/freetype/platform_fonts.c:766

    Indirect leak of 7 byte(s) in 1 object(s) allocated from:
        #0 0x7ffff791b9a0 in strdup (/nix/store/ab3753m6i7isgvzphlar0a8xb84gl96i-gcc-15.2.0-lib/lib/libasan.so.8+0x11b9a0)
        #1 0x7bffe5c30c5c in IA__FcValueSave (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x27c5c)
        #2 0x7bffe5c31ecd in FcPatternObjectAddWithBinding (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x28ecd)
        #3 0x7bffe5c33aff in FcPatternAppend (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x2aaff)
        #4 0x7bffe5c3dc43 in FcEndElement (/nix/store/a8lqn6cgwpab63c14xff3cqp8zfrvna4-fontconfig-2.17.1-lib/lib/libfontconfig.so.1+0x34c43)
        #5 0x7bffe4be6ae4 in doContent (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0xfae4)
        #6 0x7bffe4be7a90 in contentProcessor (/nix/store/cr8mzl7cj4s5mriwrqnf9cvadw1iai5m-expat-2.7.4/lib/libexpat.so.1+0x10a90)
        
- - - - -


1 changed file:

- modules/text_renderer/freetype/fonts/fontconfig.c


Changes:

=====================================
modules/text_renderer/freetype/fonts/fontconfig.c
=====================================
@@ -9,6 +9,7 @@
  *          Jean-Baptiste Kempf <jb at videolan.org>
  *          Felix Paul Kühne <fkuehne at videolan.org>
  *          Salah-Eddin Shaban <salshaaban at gmail.com>
+ *          Alexandre Janniaux <ajanni at videolabs.io>
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published by
@@ -49,6 +50,15 @@ static FcConfig *config;
 static uintptr_t refs;
 static vlc_mutex_t lock = VLC_STATIC_MUTEX;
 
+static void FontConfig_DefaultSubstitute( FcPattern *p_pattern )
+{
+#if FC_VERSION >= 21700
+    FcConfigSetDefaultSubstitute( config, p_pattern );
+#else
+    FcDefaultSubstitute( p_pattern );
+#endif
+}
+
 int FontConfig_Prepare( vlc_font_select_t *fs )
 {
     int ret = VLC_SUCCESS;
@@ -94,6 +104,7 @@ int FontConfig_Prepare( vlc_font_select_t *fs )
     if( i_dialog_id != 0 )
         vlc_dialog_cancel( fs->p_obj, i_dialog_id );
 
+end:
 #endif
 
     if (ret != VLC_SUCCESS)
@@ -159,7 +170,7 @@ static void FontConfig_FillFaces( vlc_family_t *p_family )
         FcPatternAddString( pat, FC_FAMILY, (const FcChar8 *) p_family->psz_name );
         FcPatternAddBool( pat, FC_OUTLINE, FcTrue );
 
-        FcFontSet *fs = FcFontList( 0, pat, os );
+        FcFontSet *fs = FcFontList( config, pat, os );
         FcObjectSetDestroy( os );
         if( fs )
         {
@@ -204,7 +215,7 @@ int FontConfig_SelectAmongFamilies( vlc_font_select_t *fs, const fontfamilies_t
     FcPatternAddBool( pat, FC_OUTLINE, FcTrue );
 
     /* */
-    FcDefaultSubstitute( pat );
+    FontConfig_DefaultSubstitute( pat );
     if( !FcConfigSubstitute( config, pat, FcMatchPattern ) )
     {
         FcPatternDestroy( pat );
@@ -213,9 +224,9 @@ int FontConfig_SelectAmongFamilies( vlc_font_select_t *fs, const fontfamilies_t
 
     /* Find the best font for the pattern, destroy the pattern */
     p_matchpat = FcFontMatch( config, pat, &result );
+    FcPatternDestroy( pat );
     if( !p_matchpat )
         return VLC_EGENERIC;
-    FcPatternDestroy( pat );
     if( result == FcResultNoMatch )
     {
         *pp_result = NULL;
@@ -291,7 +302,7 @@ int FontConfig_GetFallbacksAmongFamilies( vlc_font_select_t *fs, const fontfamil
     vlc_family_t *p_current = NULL;
     if( FcConfigSubstitute( config, p_pattern, FcMatchPattern ) == FcTrue )
     {
-        FcDefaultSubstitute( p_pattern );
+        FontConfig_DefaultSubstitute( p_pattern );
         FcResult result;
         FcFontSet* p_font_set = FcFontSort( config, p_pattern, FcTrue, NULL, &result );
         if( p_font_set )



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e175eb550e986e1d10550992b03e4d451a3ec6f2...bdf90112d2984b8a4ebb05e5321f682b424e22f6

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e175eb550e986e1d10550992b03e4d451a3ec6f2...bdf90112d2984b8a4ebb05e5321f682b424e22f6
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list