valgrind suppressions: ignore XInitThreads leaks
authorMathieu Duponchelle <mathieu@centricular.com>
Thu, 12 Apr 2018 16:50:35 +0000 (18:50 +0200)
committerMathieu Duponchelle <mathieu@centricular.com>
Thu, 12 Apr 2018 17:08:41 +0000 (19:08 +0200)
As we load that symbol dynamically, valgrind gets confused
when it leaks and reports the leak against an unrelated library
and an unknown (??) symbol.

To address that, put the loading and calling of that symbol
in a separate function, and ignore any malloc leak happening
in that function.

tests/check/generic/states.c
tests/check/gst-plugins-base.supp

index 1167916..bd33b41 100644 (file)
@@ -203,12 +203,14 @@ GST_START_TEST (test_state_changes_down_seq)
 
 GST_END_TEST;
 
-
-static Suite *
-states_suite (void)
+/* Separate function because XInitThreads leaks, but valgrind
+ * gets confused when a dynamically loaded symbol leaks, and
+ * shows it as a ??? symbol in an unrelated library, making
+ * it awkward to ignore in the suppression files
+ */
+static void
+call_xinitthreads (void)
 {
-  Suite *s = suite_create ("states_base");
-  TCase *tc_chain = tcase_create ("general");
   GModule *libx11;
 
   libx11 =
@@ -220,6 +222,15 @@ states_suite (void)
     }
     g_module_close (libx11);
   }
+}
+
+static Suite *
+states_suite (void)
+{
+  Suite *s = suite_create ("states_base");
+  TCase *tc_chain = tcase_create ("general");
+
+  call_xinitthreads ();
 
   suite_add_tcase (s, tc_chain);
   tcase_add_checked_fixture (tc_chain, setup, teardown);
index 3e923c8..0c92fbc 100644 (file)
    fun:glXChooseFBConfig
    fun:gst_gl_context_glx_choose_format
 }
+{
+   <a one time alloc>
+   Memcheck:Leak
+   match-leak-kinds: definite
+   fun:malloc
+   ...
+   fun:call_xinitthreads
+   fun:states_suite
+}