From 773d88e9be770089e14857ebe0225ddb239c4928 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Tue, 4 May 2021 11:20:05 -0400 Subject: [PATCH] Fix #76, in which Valgrind reports a leaked FontConfig object in sndfile-spectrogram Certain FontConfig objects indirectly referenced via the Cairo static data are referenced by integer offsets rather than by pointers, so they appear lost to Valgrind unless we call cairo_debug_reset_static_data(). --- src/spectrogram.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/spectrogram.c b/src/spectrogram.c index 8bb5950..55e2ff4 100644 --- a/src/spectrogram.c +++ b/src/spectrogram.c @@ -1063,5 +1063,13 @@ main (int argc, char * argv []) render_sndfile (&render) ; + /* Certain FontConfig objects indirectly referenced via the Cairo + * static data are referenced by integer offsets rather than by + * pointers, so they appear lost to Valgrind unless we call this + * function. Otherwise we would not really care care about freeing + * static data before exiting. + */ + cairo_debug_reset_static_data () ; + return 0 ; } /* main */ -- 2.31.1