tests: Add missing unrefs of objects after use
authorSebastian Rasmussen <sebras@hotmail.com>
Wed, 6 Aug 2014 11:41:46 +0000 (13:41 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Wed, 6 Aug 2014 13:18:56 +0000 (15:18 +0200)
Unreffing the objects returned by gst_bin_get_by_name() and
gst_pipeline_get_use() were missing in several tests, so add these.

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

tests/check/elements/appsrc.c
tests/examples/app/appsink-src.c
tests/examples/audio/audiomix.c
tests/examples/audio/volume.c
tests/examples/dynamic/codec-select.c
tests/examples/seek/scrubby.c
tests/examples/snapshot/snapshot.c
tests/icles/stress-videooverlay.c
tests/icles/test-textoverlay.c

index c31ed4c..29371ba 100644 (file)
@@ -150,6 +150,7 @@ on_source_message (GstBus * bus, GstMessage * message, ProgramData * data)
       source = gst_bin_get_by_name (GST_BIN (data->sink), "testsource");
       fail_unless (gst_app_src_end_of_stream (GST_APP_SRC (source)) ==
           GST_FLOW_OK);
+      gst_object_unref (source);
       break;
     case GST_MESSAGE_ERROR:
       g_main_loop_quit (data->loop);
index ecf7f05..0c31c4a 100644 (file)
@@ -24,6 +24,7 @@ on_new_sample_from_sink (GstElement * elt, ProgramData * data)
   GstSample *sample;
   GstBuffer *app_buffer, *buffer;
   GstElement *source;
+  GstFlowReturn ret;
 
   /* get the sample from appsink */
   sample = gst_app_sink_pull_sample (GST_APP_SINK (elt));
@@ -37,7 +38,10 @@ on_new_sample_from_sink (GstElement * elt, ProgramData * data)
 
   /* get source an push new buffer */
   source = gst_bin_get_by_name (GST_BIN (data->sink), "testsource");
-  return gst_app_src_push_buffer (GST_APP_SRC (source), app_buffer);
+  ret = gst_app_src_push_buffer (GST_APP_SRC (source), app_buffer);
+  gst_object_unref (source);
+
+  return ret;
 }
 
 /* called when we get a GstMessage from the source pipeline when we get EOS, we
@@ -52,6 +56,7 @@ on_source_message (GstBus * bus, GstMessage * message, ProgramData * data)
       g_print ("The source got dry\n");
       source = gst_bin_get_by_name (GST_BIN (data->sink), "testsource");
       gst_app_src_end_of_stream (GST_APP_SRC (source));
+      gst_object_unref (source);
       break;
     case GST_MESSAGE_ERROR:
       g_print ("Received error\n");
index dfe95c8..2b87f39 100644 (file)
@@ -206,6 +206,7 @@ main (int argc, char *argv[])
   gtk_main ();
   gst_element_set_state (pipeline, GST_STATE_NULL);
   gst_object_unref (pipeline);
+  gst_object_unref (bus);
 
   return 0;
 }
index 5e0d5ef..26d6bb1 100644 (file)
@@ -170,6 +170,7 @@ main (int argc, char *argv[])
   gtk_main ();
   gst_element_set_state (pipeline, GST_STATE_NULL);
   gst_object_unref (pipeline);
+  gst_object_unref (bus);
 
   return 0;
 }
index 0169370..b01d554 100644 (file)
@@ -214,6 +214,7 @@ do_switch (GstElement * pipeline)
 
   /* set the active pad */
   g_object_set (select, "active-pad", pad, NULL);
+  gst_object_unref (select);
 
   return TRUE;
 }
index ac5b2b4..7ba3600 100644 (file)
@@ -559,6 +559,8 @@ main (int argc, char **argv)
   g_print ("NULL pipeline\n");
   gst_element_set_state (pipeline, GST_STATE_NULL);
 
+  gst_object_unref (bus);
+
   g_print ("free pipeline\n");
   gst_object_unref (pipeline);
 
index 4ddad45..3ebdc15 100644 (file)
@@ -104,6 +104,7 @@ main (int argc, char *argv[])
   /* get the preroll buffer from appsink, this block untils appsink really
    * prerolls */
   g_signal_emit_by_name (sink, "pull-preroll", &sample, NULL);
+  gst_object_unref (sink);
 
   /* if we have a buffer now, convert it to a pixbuf. It's possible that we
    * don't have a buffer because we went EOS right away or had an error. */
index 433aca2..c7e127c 100644 (file)
@@ -242,5 +242,7 @@ main (int argc, char **argv)
 
   g_main_loop_unref (loop);
 
+  gst_object_unref (bus);
+
   return 0;
 }
index c1c59d5..13a2b3f 100644 (file)
@@ -106,6 +106,7 @@ test_textoverlay (int width, int height)
     }
   }
 
+  gst_object_unref (toverlay);
   g_free (pstr);
 }