gst/parse/grammar.y: Fix a leak in parse-launch for any source-or-sink named element references used.

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.
This commit is contained in:
Michael Smith 2006-04-06 10:38:54 +00:00
parent 96d945bc58
commit 5fc678a6a7
4 changed files with 18 additions and 1 deletions

View file

@ -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):

2
common

@ -1 +1 @@
Subproject commit cbedff4d5f090d43fdeaa189748a6651f2c6a07f
Subproject commit 623fe1c2cce45bc30d5823c05716349874ae994e

View 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;
}

View 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