From b1b1fe52d611670c7718533d67d164e4ffa3c975 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Tue, 1 Nov 2005 15:11:16 +0000 Subject: Fix leaks and invalid memory access as reported by valgrind Original commit message from CVS: * check/elements/matroskamux.c: (setup_src_pad), (setup_sink_pad), (setup_matroskamux), (check_buffer_data), (GST_START_TEST): * gst/matroska/matroska-mux.c: (gst_matroska_mux_finalize), (gst_matroska_mux_reset), (gst_matroska_mux_audio_pad_setcaps), (gst_matroska_mux_start), (gst_matroska_mux_write_data), (gst_matroska_mux_collected): Fix leaks and invalid memory access as reported by valgrind --- tests/check/elements/matroskamux.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/check/elements/matroskamux.c b/tests/check/elements/matroskamux.c index 8b31014e..30bf09f1 100644 --- a/tests/check/elements/matroskamux.c +++ b/tests/check/elements/matroskamux.c @@ -56,15 +56,16 @@ static GstStaticPadTemplate srcac3template = GST_STATIC_PAD_TEMPLATE ("src", GstPad * setup_src_pad (GstElement * element, - GstStaticPadTemplate * srctemplate, GstCaps * caps) + GstStaticPadTemplate * template, GstCaps * caps) { GstPad *srcpad, *sinkpad; + GstPadTemplate *templ; GST_DEBUG_OBJECT (element, "setting up sending pad"); /* sending pad */ - srcpad = - gst_pad_new_from_template (gst_static_pad_template_get (srctemplate), - "src"); + templ = gst_static_pad_template_get (template); + srcpad = gst_pad_new_from_template (templ, "src"); + gst_object_unref (templ); fail_if (srcpad == NULL, "Could not create a srcpad"); ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1); @@ -110,12 +111,14 @@ setup_sink_pad (GstElement * element, GstStaticPadTemplate * template, GstCaps * caps) { GstPad *srcpad, *sinkpad; + GstPadTemplate *templ; GST_DEBUG_OBJECT (element, "setting up receiving pad"); /* receiving pad */ - sinkpad = - gst_pad_new_from_template (gst_static_pad_template_get (template), - "sink"); + templ = gst_static_pad_template_get (template); + sinkpad = gst_pad_new_from_template (templ, "sink"); + gst_object_unref (templ); + fail_if (sinkpad == NULL, "Could not create a sinkpad"); srcpad = gst_element_get_pad (element, "src"); -- cgit