From 27c52fb4e38278c381a8d2e58f239cec57249a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 31 Mar 2023 10:30:58 +0200 Subject: [PATCH] test: config: call FcIni() + FcFini() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some of the config options we’re testing result in calls to FontConfig APIs. Without calling FcIni()+FcFini(), we leak memory: Direct leak of 768 byte(s) in 3 object(s) allocated from: #0 0x7f7e95cbfa89 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69 #1 0x7f7e95bd1fe5 (/usr/lib/libfontconfig.so.1+0x20fe5) Indirect leak of 96 byte(s) in 3 object(s) allocated from: #0 0x7f7e95cbf411 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:77 #1 0x7f7e95bd63fd (/usr/lib/libfontconfig.so.1+0x253fd) Indirect leak of 19 byte(s) in 2 object(s) allocated from: #0 0x7f7e95c72faa in __interceptor_strdup /build/gcc/src/gcc/libsanitizer/asan/asan_interceptors.cpp:439 #1 0x7f7e95bd1898 in FcValueSave (/usr/lib/libfontconfig.so.1+0x20898) --- tests/test-config.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test-config.c b/tests/test-config.c index 6b44e9c2..4736a46b 100644 --- a/tests/test-config.c +++ b/tests/test-config.c @@ -1304,6 +1304,7 @@ test_section_tweak(void) int main(int argc, const char *const *argv) { + FcInit(); log_init(LOG_COLORIZE_AUTO, false, 0, LOG_CLASS_ERROR); test_section_main(); test_section_bell(); @@ -1325,5 +1326,6 @@ main(int argc, const char *const *argv) test_section_environment(); test_section_tweak(); log_deinit(); + FcFini(); return 0; }