check/Makefile.am: instate more valgrindable tests
authorThomas Vander Stichele <thomas@apestaart.org>
Tue, 12 Jul 2005 09:41:00 +0000 (09:41 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Tue, 12 Jul 2005 09:41:00 +0000 (09:41 +0000)
Original commit message from CVS:
2005-07-12  Thomas Vander Stichele  <thomas at apestaart dot org>

* check/Makefile.am:
instate more valgrindable tests
* check/elements/gstfakesrc.c: (chain_func), (event_func),
(GST_START_TEST), (fakesrc_suite):
* check/gst/gstpad.c: (GST_START_TEST):
* check/gst/gststructure.c: (GST_START_TEST):
fix test leaks
* docs/gst/tmpl/gstminiobject.sgml:
* gst/gstpad.c: (gst_pad_finalize):
fix the static mutex leak

ChangeLog
check/Makefile.am
check/elements/gstfakesrc.c
check/gst/gstpad.c
check/gst/gststructure.c
docs/gst/tmpl/gstminiobject.sgml
gst/gstpad.c
tests/check/Makefile.am
tests/check/elements/gstfakesrc.c
tests/check/gst/gstpad.c
tests/check/gst/gststructure.c

index 2e95c24..61f04ab 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2005-07-12  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * check/Makefile.am:
+         instate more valgrindable tests
+       * check/elements/gstfakesrc.c: (chain_func), (event_func),
+       (GST_START_TEST), (fakesrc_suite):
+       * check/gst/gstpad.c: (GST_START_TEST):
+       * check/gst/gststructure.c: (GST_START_TEST):
+         fix test leaks
+       * docs/gst/tmpl/gstminiobject.sgml:
+       * gst/gstpad.c: (gst_pad_finalize):
+         fix the static mutex leak
+
 2005-07-11  Thomas Vander Stichele  <thomas at apestaart dot org>
 
        * check/Makefile.am:
index c870af4..4271ee1 100644 (file)
@@ -70,11 +70,8 @@ gst_libs_gdp_CFLAGS = $(AM_CFLAGS) -DGST_ENABLE_NEW
 TESTS_TO_FIX =                                 \
        gst/gstghostpad                         \
        gst/gstiterator                         \
-       gst/gstpad                              \
        gst/gstsystemclock                      \
-       gst/gststructure                        \
        gst/gsttag                              \
-       elements/gstfakesrc                     \
        pipelines/cleanup                       \
        pipelines/simple_launch_lines           \
        gst-libs/gdp
index bcd9d1d..85be97f 100644 (file)
@@ -49,9 +49,11 @@ event_func (GstPad * pad, GstEvent * event)
     GST_STREAM_LOCK (pad);
     have_eos = TRUE;
     GST_STREAM_UNLOCK (pad);
+    gst_event_unref (event);
     return TRUE;
   }
 
+  gst_event_unref (event);
   return FALSE;
 }
 
@@ -93,6 +95,13 @@ GST_START_TEST (test_num_buffers)
   fail_unless (g_list_length (buffers) == 3);
   g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
   g_list_free (buffers);
+
+  /* cleanup */
+  fail_unless (gst_element_set_state (src, GST_STATE_NULL) == GST_STATE_SUCCESS,
+      "could not set to null");
+
+  gst_object_unref (src);
+  gst_object_unref (sinkpad);
 }
 
 GST_END_TEST;
index 7ae7a2b..5283c20 100644 (file)
@@ -31,21 +31,32 @@ GST_START_TEST (test_link)
 
   src = gst_pad_new ("source", GST_PAD_SRC);
   fail_if (src == NULL);
+  ASSERT_OBJECT_REFCOUNT (src, "source pad", 1);
 
   name = gst_pad_get_name (src);
   fail_unless (strcmp (name, "source") == 0);
+  ASSERT_OBJECT_REFCOUNT (src, "source pad", 1);
+  g_free (name);
 
   sink = gst_pad_new ("sink", GST_PAD_SINK);
   fail_if (sink == NULL);
 
   /* linking without templates or caps should fail */
   ret = gst_pad_link (src, sink);
+  ASSERT_OBJECT_REFCOUNT (src, "source pad", 1);
+  ASSERT_OBJECT_REFCOUNT (sink, "sink pad", 1);
   fail_unless (ret == GST_PAD_LINK_NOFORMAT);
 
   ASSERT_CRITICAL (gst_pad_get_pad_template (NULL));
 
   srct = gst_pad_get_pad_template (src);
   fail_unless (srct == NULL);
+  ASSERT_OBJECT_REFCOUNT (src, "source pad", 1);
+
+  /* clean up */
+  ASSERT_OBJECT_REFCOUNT (src, "source pad", 1);
+  gst_object_unref (src);
+  gst_object_unref (sink);
 }
 
 GST_END_TEST;
index 93c8cc0..06a1102 100644 (file)
@@ -60,6 +60,9 @@ GST_START_TEST (test_from_string_int)
     fail_unless (value == results[i],
         "Value %d is not the expected result %d for string %s",
         value, results[i], s);
+
+    /* cleanup */
+    gst_structure_free (structure);
   }
 }
 
index 96f37ad..5481e39 100644 (file)
@@ -9,13 +9,11 @@ GstMiniObject
 
 </para>
 
-
 <!-- ##### SECTION See_Also ##### -->
 <para>
 
 </para>
 
-
 <!-- ##### STRUCT GstMiniObject ##### -->
 <para>
 
index 1abc6d9..811e906 100644 (file)
@@ -270,6 +270,7 @@ gst_pad_finalize (GObject * object)
 
   if (pad->stream_rec_lock) {
     g_static_rec_mutex_free (pad->stream_rec_lock);
+    g_free (pad->stream_rec_lock);
     pad->stream_rec_lock = NULL;
   }
   if (pad->preroll_lock) {
index c870af4..4271ee1 100644 (file)
@@ -70,11 +70,8 @@ gst_libs_gdp_CFLAGS = $(AM_CFLAGS) -DGST_ENABLE_NEW
 TESTS_TO_FIX =                                 \
        gst/gstghostpad                         \
        gst/gstiterator                         \
-       gst/gstpad                              \
        gst/gstsystemclock                      \
-       gst/gststructure                        \
        gst/gsttag                              \
-       elements/gstfakesrc                     \
        pipelines/cleanup                       \
        pipelines/simple_launch_lines           \
        gst-libs/gdp
index bcd9d1d..85be97f 100644 (file)
@@ -49,9 +49,11 @@ event_func (GstPad * pad, GstEvent * event)
     GST_STREAM_LOCK (pad);
     have_eos = TRUE;
     GST_STREAM_UNLOCK (pad);
+    gst_event_unref (event);
     return TRUE;
   }
 
+  gst_event_unref (event);
   return FALSE;
 }
 
@@ -93,6 +95,13 @@ GST_START_TEST (test_num_buffers)
   fail_unless (g_list_length (buffers) == 3);
   g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
   g_list_free (buffers);
+
+  /* cleanup */
+  fail_unless (gst_element_set_state (src, GST_STATE_NULL) == GST_STATE_SUCCESS,
+      "could not set to null");
+
+  gst_object_unref (src);
+  gst_object_unref (sinkpad);
 }
 
 GST_END_TEST;
index 7ae7a2b..5283c20 100644 (file)
@@ -31,21 +31,32 @@ GST_START_TEST (test_link)
 
   src = gst_pad_new ("source", GST_PAD_SRC);
   fail_if (src == NULL);
+  ASSERT_OBJECT_REFCOUNT (src, "source pad", 1);
 
   name = gst_pad_get_name (src);
   fail_unless (strcmp (name, "source") == 0);
+  ASSERT_OBJECT_REFCOUNT (src, "source pad", 1);
+  g_free (name);
 
   sink = gst_pad_new ("sink", GST_PAD_SINK);
   fail_if (sink == NULL);
 
   /* linking without templates or caps should fail */
   ret = gst_pad_link (src, sink);
+  ASSERT_OBJECT_REFCOUNT (src, "source pad", 1);
+  ASSERT_OBJECT_REFCOUNT (sink, "sink pad", 1);
   fail_unless (ret == GST_PAD_LINK_NOFORMAT);
 
   ASSERT_CRITICAL (gst_pad_get_pad_template (NULL));
 
   srct = gst_pad_get_pad_template (src);
   fail_unless (srct == NULL);
+  ASSERT_OBJECT_REFCOUNT (src, "source pad", 1);
+
+  /* clean up */
+  ASSERT_OBJECT_REFCOUNT (src, "source pad", 1);
+  gst_object_unref (src);
+  gst_object_unref (sink);
 }
 
 GST_END_TEST;
index 93c8cc0..06a1102 100644 (file)
@@ -60,6 +60,9 @@ GST_START_TEST (test_from_string_int)
     fail_unless (value == results[i],
         "Value %d is not the expected result %d for string %s",
         value, results[i], s);
+
+    /* cleanup */
+    gst_structure_free (structure);
   }
 }