tests: collectpads: fix for CK_FORK=no
authorTim-Philipp Müller <tim@centricular.com>
Sun, 10 Apr 2016 19:45:24 +0000 (20:45 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Sun, 10 Apr 2016 19:57:55 +0000 (20:57 +0100)
Reset global state when done, and unref sink pads too
in teardown function to make it valgrind clean.

https://bugzilla.gnome.org/show_bug.cgi?id=623469

tests/check/libs/collectpads.c

index 494b316..53a9d4c 100644 (file)
@@ -423,9 +423,14 @@ setup_buffer_cb (void)
 static void
 teardown (void)
 {
+  gst_object_unref (srcpad1);
+  gst_object_unref (srcpad2);
   gst_object_unref (sinkpad1);
   gst_object_unref (sinkpad2);
   gst_object_unref (collect);
+  srcpad1 = srcpad2 = NULL;
+  sinkpad1 = sinkpad2 = NULL;
+  collect = NULL;
 }
 
 GST_START_TEST (test_pad_add_remove)
@@ -857,6 +862,9 @@ flush_setup (void)
   g_atomic_int_set (&flush_start_events, 0);
   g_atomic_int_set (&flush_stop_events, 0);
   gst_element_set_state (agg, GST_STATE_PLAYING);
+  outbuf1 = NULL;
+  outbuf2 = NULL;
+  collected = FALSE;
 }
 
 static void
@@ -869,6 +877,10 @@ flush_teardown (void)
   gst_object_unref (srcpad2);
   g_free (data1);
   g_free (data2);
+  agg = NULL;
+  agg_srcpad = NULL;
+  srcpad1 = srcpad2 = NULL;
+  data1 = data2 = NULL;
 }
 
 GST_START_TEST (test_flushing_seek_failure)
@@ -1071,6 +1083,7 @@ gst_collect_pads_suite (void)
   suite_add_tcase (suite, general);
   tcase_add_checked_fixture (general, setup, teardown);
   tcase_add_test (general, test_pad_add_remove);
+
   tcase_add_test (general, test_collect);
   tcase_add_test (general, test_collect_eos);
   tcase_add_test (general, test_collect_twice);