gst/parse/grammar.y: Fix a leak in parse-launch for any source-or-sink named element...
authorMichael Smith <msmith@xiph.org>
Thu, 6 Apr 2006 10:38:54 +0000 (10:38 +0000)
committerMichael Smith <msmith@xiph.org>
Thu, 6 Apr 2006 10:38:54 +0000 (10:38 +0000)
Original commit message from CVS:
* gst/parse/grammar.y:
Fix a leak in parse-launch for any source-or-sink named element
references used.

* tests/check/pipelines/parse-launch.c: (expected_fail_pipe):
Unref the pipeline if it exists after we've failed parsing.

ChangeLog
common
gst/parse/grammar.y
tests/check/pipelines/parse-launch.c

index a7e43e9..73008de 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-04-06  Michael Smith  <msmith@fluendo.com>
+
+       * gst/parse/grammar.y:
+         Fix a leak in parse-launch for any source-or-sink named element 
+         references used.
+
+       * tests/check/pipelines/parse-launch.c: (expected_fail_pipe):
+         Unref the pipeline if it exists after we've failed parsing.
+
 2006-04-05  Michael Smith  <msmith@fluendo.com>
 
        * gst/gstpipeline.c: (gst_pipeline_init):
diff --git a/common b/common
index cbedff4..623fe1c 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit cbedff4d5f090d43fdeaa189748a6651f2c6a07f
+Subproject commit 623fe1c2cce45bc30d5823c05716349874ae994e
index 35a9995..c62f111 100644 (file)
@@ -874,6 +874,8 @@ _gst_parse_launch (const gchar *str, GError **error)
       if (l->src_name) {
         if (bin) {
           l->src = gst_bin_get_by_name_recurse_up (bin, l->src_name);
+          if (l->src)
+            gst_object_unref (l->src);
         } else {
           l->src = strcmp (GST_ELEMENT_NAME (ret), l->src_name) == 0 ? ret : NULL;
         }
@@ -889,6 +891,8 @@ _gst_parse_launch (const gchar *str, GError **error)
       if (l->sink_name) {
         if (bin) {
           l->sink = gst_bin_get_by_name_recurse_up (bin, l->sink_name);
+          if (l->sink)
+            gst_object_unref (l->sink);
         } else {
           l->sink = strcmp (GST_ELEMENT_NAME (ret), l->sink_name) == 0 ? ret : NULL;
         }
index 6af9c8c..b9b593b 100644 (file)
@@ -51,6 +51,10 @@ expected_fail_pipe (const gchar * pipe_descr)
   pipeline = gst_parse_launch (pipe_descr, &error);
   fail_unless (error != NULL, "Expected failure pipeline %s: succeeded!");
   g_error_free (error);
+
+  /* We get a pipeline back even when parsing has failed, sometimes! */
+  if (pipeline)
+    gst_object_unref (pipeline);
 }
 
 static void