mimdec: Fix leaks

Use gst_pad_new_from_static_template() to not leak the pad template
Also properly chain up the finalize to the parent
This commit is contained in:
Olivier Crête 2009-07-20 22:08:52 -04:00
parent 8f1301390d
commit 22b95ab4cd

View file

@ -113,16 +113,12 @@ gst_mimdec_class_init (GstMimDecClass * klass)
static void static void
gst_mimdec_init (GstMimDec * mimdec, GstMimDecClass * klass) gst_mimdec_init (GstMimDec * mimdec, GstMimDecClass * klass)
{ {
mimdec->sinkpad = mimdec->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink");
gst_pad_new_from_template (gst_static_pad_template_get (&sink_factory),
"sink");
gst_element_add_pad (GST_ELEMENT (mimdec), mimdec->sinkpad); gst_element_add_pad (GST_ELEMENT (mimdec), mimdec->sinkpad);
gst_pad_set_chain_function (mimdec->sinkpad, gst_mimdec_chain); gst_pad_set_chain_function (mimdec->sinkpad, gst_mimdec_chain);
gst_pad_set_event_function (mimdec->sinkpad, gst_mimdec_sink_event); gst_pad_set_event_function (mimdec->sinkpad, gst_mimdec_sink_event);
mimdec->srcpad = mimdec->srcpad = gst_pad_new_from_static_template (&src_factory, "src");
gst_pad_new_from_template (gst_static_pad_template_get (&src_factory),
"src");
gst_element_add_pad (GST_ELEMENT (mimdec), mimdec->srcpad); gst_element_add_pad (GST_ELEMENT (mimdec), mimdec->srcpad);
mimdec->adapter = gst_adapter_new (); mimdec->adapter = gst_adapter_new ();
@ -141,6 +137,8 @@ gst_mimdec_finalize (GObject * object)
gst_adapter_clear (mimdec->adapter); gst_adapter_clear (mimdec->adapter);
g_object_unref (mimdec->adapter); g_object_unref (mimdec->adapter);
GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
} }
static GstFlowReturn static GstFlowReturn