Plug leaks.

Original commit message from CVS:
Plug leaks.
This commit is contained in:
Johan Dahlin 2005-11-15 19:34:39 +00:00
parent 533d7d68c3
commit 4f08d8649d
3 changed files with 37 additions and 16 deletions

View file

@ -1,3 +1,11 @@
2005-11-15 Johan Dahlin <johan@gnome.org>
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_init), (gst_ogg_demux_finalize):
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_base_init),
(gst_vorbis_dec_init):
Fix pad template leaks.
2005-11-15 Tim-Philipp Müller <tim at centricular dot net> 2005-11-15 Tim-Philipp Müller <tim at centricular dot net>
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_change_state): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_change_state):

View file

@ -637,6 +637,8 @@ gst_ogg_pad_typefind (GstOggPad * pad, ogg_packet * packet)
gst_element_factory_create (GST_ELEMENT_FACTORY (factories->data), gst_element_factory_create (GST_ELEMENT_FACTORY (factories->data),
NULL); NULL);
if (element) { if (element) {
GstPadTemplate *template;
/* this is ours */ /* this is ours */
gst_object_ref (element); gst_object_ref (element);
gst_object_sink (GST_OBJECT (element)); gst_object_sink (GST_OBJECT (element));
@ -644,9 +646,9 @@ gst_ogg_pad_typefind (GstOggPad * pad, ogg_packet * packet)
/* FIXME, it might not be named "sink" */ /* FIXME, it might not be named "sink" */
pad->elem_pad = gst_element_get_pad (element, "sink"); pad->elem_pad = gst_element_get_pad (element, "sink");
gst_element_set_state (element, GST_STATE_PAUSED); gst_element_set_state (element, GST_STATE_PAUSED);
pad->elem_out = template = gst_static_pad_template_get (&internaltemplate);
gst_pad_new_from_template (gst_static_pad_template_get pad->elem_out = gst_pad_new_from_template (template, "internal");
(&internaltemplate), "internal"); g_object_unref (template);
gst_pad_set_chain_function (pad->elem_out, gst_ogg_pad_internal_chain); gst_pad_set_chain_function (pad->elem_out, gst_ogg_pad_internal_chain);
gst_pad_set_element_private (pad->elem_out, pad); gst_pad_set_element_private (pad->elem_out, pad);
gst_pad_set_active (pad->elem_out, TRUE); gst_pad_set_active (pad->elem_out, TRUE);
@ -1131,9 +1133,11 @@ static void
gst_ogg_demux_init (GstOggDemux * ogg, GstOggDemuxClass * g_class) gst_ogg_demux_init (GstOggDemux * ogg, GstOggDemuxClass * g_class)
{ {
/* create the sink pad */ /* create the sink pad */
ogg->sinkpad = GstPadTemplate *template = gst_static_pad_template_get
gst_pad_new_from_template (gst_static_pad_template_get (&ogg_demux_sink_template_factory);
(&ogg_demux_sink_template_factory), "sink"); ogg->sinkpad = gst_pad_new_from_template (template, "sink");
g_object_unref (template);
gst_pad_set_event_function (ogg->sinkpad, gst_ogg_demux_handle_event); gst_pad_set_event_function (ogg->sinkpad, gst_ogg_demux_handle_event);
gst_pad_set_chain_function (ogg->sinkpad, gst_ogg_demux_chain); gst_pad_set_chain_function (ogg->sinkpad, gst_ogg_demux_chain);
gst_pad_set_activate_function (ogg->sinkpad, gst_ogg_demux_sink_activate); gst_pad_set_activate_function (ogg->sinkpad, gst_ogg_demux_sink_activate);

View file

@ -95,11 +95,16 @@ static void
gst_vorbis_dec_base_init (gpointer g_class) gst_vorbis_dec_base_init (gpointer g_class)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstPadTemplate *src_template, *sink_template;
src_template = gst_static_pad_template_get (&vorbis_dec_src_factory);
gst_element_class_add_pad_template (element_class, src_template);
g_object_unref (src_template);
sink_template = gst_static_pad_template_get (&vorbis_dec_sink_factory);
gst_element_class_add_pad_template (element_class, sink_template);
g_object_unref (sink_template);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&vorbis_dec_src_factory));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&vorbis_dec_sink_factory));
gst_element_class_set_details (element_class, &vorbis_dec_details); gst_element_class_set_details (element_class, &vorbis_dec_details);
} }
@ -162,17 +167,21 @@ vorbis_get_query_types (GstPad * pad)
static void static void
gst_vorbis_dec_init (GstVorbisDec * dec, GstVorbisDecClass * g_class) gst_vorbis_dec_init (GstVorbisDec * dec, GstVorbisDecClass * g_class)
{ {
dec->sinkpad = GstPadTemplate *template;
gst_pad_new_from_template (gst_static_pad_template_get
(&vorbis_dec_sink_factory), "sink"); template = gst_static_pad_template_get (&vorbis_dec_sink_factory);
dec->sinkpad = gst_pad_new_from_template (template, "sink");
g_object_unref (template);
gst_pad_set_event_function (dec->sinkpad, vorbis_dec_sink_event); gst_pad_set_event_function (dec->sinkpad, vorbis_dec_sink_event);
gst_pad_set_chain_function (dec->sinkpad, vorbis_dec_chain); gst_pad_set_chain_function (dec->sinkpad, vorbis_dec_chain);
gst_pad_set_query_function (dec->sinkpad, vorbis_dec_sink_query); gst_pad_set_query_function (dec->sinkpad, vorbis_dec_sink_query);
gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad); gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad);
dec->srcpad = template = gst_static_pad_template_get (&vorbis_dec_src_factory);
gst_pad_new_from_template (gst_static_pad_template_get dec->srcpad = gst_pad_new_from_template (template, "src");
(&vorbis_dec_src_factory), "src"); g_object_unref (template);
gst_pad_set_event_function (dec->srcpad, vorbis_dec_src_event); gst_pad_set_event_function (dec->srcpad, vorbis_dec_src_event);
gst_pad_set_query_type_function (dec->srcpad, vorbis_get_query_types); gst_pad_set_query_type_function (dec->srcpad, vorbis_get_query_types);
gst_pad_set_query_function (dec->srcpad, vorbis_dec_src_query); gst_pad_set_query_function (dec->srcpad, vorbis_dec_src_query);