On 28-Sep-2012 16:32, Raimund Steger wrote:
mathog wrote:
The small attached program blows up in FcFini() when it is run on
Ubuntu
I think FcFini does not take care of patterns you allocated. You need
to dereference/deallocate them with FcPatternDestroy beforehand.
Good call. Adding
FcPatternDestroy(fpat);
FcPatternDestroy(pattern);
before FcFini() eliminated the crash and valgrind showed no memory
hanging around at program exit. (So variables
FontMatrix and filename, which are also pointers, apparnetly point to
areas of memory which are
cleared by it, and not to copies of memory which are not cleared.)
However, valgrind still shows multiple errors in the single call to
FcFinit() (determined by sprinkling
printf("Mark\n");fflush(stdout)
calls through the code):
==2554== Invalid read of size 4
==2554== at 0x40EF4A2: ??? (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x40F1B09: FcConfigFilename (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x41061EB: FcConfigParseAndLoad (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x41364D2: (below main) (libc-start.c:226)
==2554== Address 0x4304334 is 20 bytes inside a block of size 22
alloc'd
==2554== at 0x402BE68: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2554== by 0x40EF407: ??? (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x40F1B09: FcConfigFilename (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x41061EB: FcConfigParseAndLoad (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x41364D2: (below main) (libc-start.c:226)
==2554==
==2554== Invalid read of size 4
==2554== at 0x40EF4B6: ??? (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x900642D: ???
==2554== Address 0x430a3d8 is 16 bytes inside a block of size 18
alloc'd
==2554== at 0x402BE68: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2554== by 0x40EF407: ??? (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x900642D: ???
==2554==
==2554== Invalid read of size 4
==2554== at 0x40EF4B6: ??? (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x41061EB: FcConfigParseAndLoad (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x41066A8: FcConfigParseAndLoad (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x4106A63: ??? (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== Address 0x431e0e8 is 40 bytes inside a block of size 42
alloc'd
==2554== at 0x402BE68: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2554== by 0x40EF407: ??? (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x41061EB: FcConfigParseAndLoad (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x41066A8: FcConfigParseAndLoad (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x4106A63: ??? (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554==
==2554== Invalid read of size 4
==2554== at 0x40EF4A2: ??? (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x41061EB: FcConfigParseAndLoad (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x41066A8: FcConfigParseAndLoad (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x4106A63: ??? (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== Address 0x434d164 is 36 bytes inside a block of size 39
alloc'd
==2554== at 0x402BE68: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2554== by 0x40EF407: ??? (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x41061EB: FcConfigParseAndLoad (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x41066A8: FcConfigParseAndLoad (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x4106A63: ??? (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554==
==2554== Invalid read of size 4
==2554== at 0x40EF4B6: ??? (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x2E73746D: ???
==2554== Address 0x436f1e0 is 16 bytes inside a block of size 19
alloc'd
==2554== at 0x402BE68: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2554== by 0x40EF407: ??? (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x2E73746D: ???
==2554==
==2554== Invalid read of size 4
==2554== at 0x40EF4A2: ??? (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x6F632E6B: ???
==2554== Address 0x4376934 is 20 bytes inside a block of size 22
alloc'd
==2554== at 0x402BE68: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2554== by 0x40EF407: ??? (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==2554== by 0x6F632E6B: ???
==2554==
Thanks,
David Mathog
mathog@xxxxxxxxxxx
Manager, Sequence Analysis Facility, Biology Division, Caltech
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig