tests: Fix more leaks
authorEdward Hervey <edward.hervey@collabora.co.uk>
Tue, 11 Oct 2011 11:54:45 +0000 (13:54 +0200)
committerEdward Hervey <edward.hervey@collabora.co.uk>
Tue, 11 Oct 2011 11:54:45 +0000 (13:54 +0200)
tests/check/generic/states.c
tests/check/gst/gstevent.c
tests/check/gst/gstghostpad.c
tests/check/gst/gstpad.c
tests/check/gst/gstutils.c
tests/check/gst/gstvalue.c

index 4db8a1b..97b8191 100644 (file)
@@ -59,12 +59,14 @@ setup (void)
 
     for (f = features; f; f = f->next) {
       GstPluginFeature *feature = f->data;
-      const gchar *name = gst_plugin_feature_get_name (feature);
+      gchar *name;
       gboolean ignore = FALSE;
 
       if (!GST_IS_ELEMENT_FACTORY (feature))
         continue;
 
+      name = gst_plugin_feature_get_name (feature);
+
       if (ignorelist) {
         gchar **s;
 
@@ -74,12 +76,14 @@ setup (void)
             ignore = TRUE;
           }
         }
-        if (ignore)
+        if (ignore) {
+          g_free (name);
           continue;
+        }
       }
 
       GST_DEBUG ("adding element %s", name);
-      elements = g_list_prepend (elements, (gpointer) g_strdup (name));
+      elements = g_list_prepend (elements, name);
     }
     gst_plugin_feature_list_free (features);
   }
index 296ec56..9fbf41e 100644 (file)
@@ -542,6 +542,8 @@ GST_START_TEST (send_custom_events)
   gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL,
       GST_CLOCK_TIME_NONE);
 
+  gst_object_unref (sinkpad);
+  gst_object_unref (srcpad);
   gst_object_unref (pipeline);
 }
 
index 068a6e9..4271b11 100644 (file)
@@ -241,6 +241,7 @@ GST_START_TEST (test_remove_target)
   fail_unless (target == NULL);
 
   gst_object_unref (b1);
+  gst_object_unref (ghost);
 }
 
 GST_END_TEST;
@@ -717,6 +718,7 @@ GST_START_TEST (test_ghost_pads_forward_setcaps)
 
   gst_object_unref (ghost);
   gst_caps_unref (caps1);
+  gst_caps_unref (caps2);
 
   /* source 2, setting the caps on the ghostpad does not influence the caps of
    * the target */
@@ -760,6 +762,7 @@ GST_START_TEST (test_ghost_pads_forward_setcaps)
 
   gst_object_unref (ghost);
   gst_caps_unref (caps1);
+  gst_caps_unref (caps2);
 
   /* clear caps on pads */
   gst_pad_set_active (src, FALSE);
index 5b9e1bf..1574814 100644 (file)
@@ -218,9 +218,10 @@ static gboolean
 name_is_valid (const gchar * name, GstPadPresence presence)
 {
   GstPadTemplate *new;
-  GstCaps *any = GST_CAPS_ANY;
+  GstCaps *any = gst_caps_new_any ();
 
   new = gst_pad_template_new (name, GST_PAD_SRC, presence, any);
+  gst_caps_unref (any);
   if (new) {
     gst_object_unref (GST_OBJECT (new));
     return TRUE;
index 9498c04..f024812 100644 (file)
@@ -501,6 +501,7 @@ GST_START_TEST (test_element_found_tags)
   gst_element_set_state (pipeline, GST_STATE_PLAYING);
 
   gst_element_found_tags (GST_ELEMENT (fakesrc), list);
+  gst_tag_list_free (list);
 
   bus = gst_element_get_bus (pipeline);
   message = gst_bus_poll (bus, GST_MESSAGE_EOS, -1);
index 11a5584..5025066 100644 (file)
@@ -759,14 +759,14 @@ GST_START_TEST (test_value_intersect)
   g_value_unset (&src2);
 
   g_value_init (&src1, G_TYPE_STRING);
-  g_value_set_string (&src1, "YUY2");
+  g_value_set_static_string (&src1, "YUY2");
   g_value_init (&src2, GST_TYPE_LIST);
   g_value_init (&item, G_TYPE_STRING);
-  g_value_set_string (&item, "YUY2");
+  g_value_set_static_string (&item, "YUY2");
   gst_value_list_append_value (&src2, &item);
-  g_value_set_string (&item, "I420");
+  g_value_set_static_string (&item, "I420");
   gst_value_list_append_value (&src2, &item);
-  g_value_set_string (&item, "ABCD");
+  g_value_set_static_string (&item, "ABCD");
   gst_value_list_append_value (&src2, &item);
 
   fail_unless (gst_value_intersect (&dest, &src1, &src2));
@@ -775,6 +775,7 @@ GST_START_TEST (test_value_intersect)
 
   g_value_unset (&src1);
   g_value_unset (&src2);
+  g_value_unset (&dest);
 }
 
 GST_END_TEST;