Fix pad template memleaks

Pad templates returned by gst_static_pad_template_get() were not
being unreffed.
This commit is contained in:
David Schleef 2010-11-27 20:13:38 -08:00
parent 4eee2dc95d
commit 159e2768d6
5 changed files with 15 additions and 28 deletions

View file

@ -140,14 +140,13 @@ gst_diracdec_init (GstDiracDec * diracdec)
/* create the sink and src pads */
diracdec->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get
(&gst_diracdec_sink_pad_template), "sink");
gst_pad_new_from_static_template (&gst_diracdec_sink_pad_template,
"sink");
gst_pad_set_chain_function (diracdec->sinkpad, gst_diracdec_chain);
gst_element_add_pad (GST_ELEMENT (diracdec), diracdec->sinkpad);
diracdec->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get
(&gst_diracdec_src_pad_template), "src");
gst_pad_new_from_static_template (&gst_diracdec_src_pad_template, "src");
gst_pad_use_explicit_caps (diracdec->srcpad);
gst_element_add_pad (GST_ELEMENT (diracdec), diracdec->srcpad);
@ -258,16 +257,15 @@ gst_diracdec_chain (GstPad * pad, GstData * _data)
diracdec->decoder->seq_params.width,
diracdec->decoder->seq_params.height,
(gdouble) fps_num / (gdouble) fps_denom,
gst_diracdec_chroma_to_fourcc (diracdec->decoder->
seq_params.chroma))) {
gst_diracdec_chroma_to_fourcc (diracdec->decoder->seq_params.
chroma))) {
GST_ELEMENT_ERROR (diracdec, CORE, NEGOTIATION, (NULL),
("Failed to set caps to %dx%d @ %d fps (format=" GST_FOURCC_FORMAT
"/%d)", diracdec->decoder->seq_params.width,
diracdec->decoder->seq_params.height,
diracdec->decoder->seq_params.frame_rate,
gst_diracdec_chroma_to_fourcc (diracdec->decoder->
seq_params.chroma),
diracdec->decoder->seq_params.chroma));
gst_diracdec_chroma_to_fourcc (diracdec->decoder->seq_params.
chroma), diracdec->decoder->seq_params.chroma));
c = FALSE;
break;
}

View file

@ -191,11 +191,8 @@ gst_live_adder_class_init (GstLiveAdderClass * klass)
static void
gst_live_adder_init (GstLiveAdder * adder, GstLiveAdderClass * klass)
{
GstPadTemplate *template;
template = gst_static_pad_template_get (&gst_live_adder_src_template);
adder->srcpad = gst_pad_new_from_template (template, "src");
gst_object_unref (template);
adder->srcpad =
gst_pad_new_from_static_template (&gst_live_adder_src_template, "src");
gst_pad_set_getcaps_function (adder->srcpad,
GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
gst_pad_set_setcaps_function (adder->srcpad,

View file

@ -140,9 +140,8 @@ mpegpsmux_class_init (MpegPsMuxClass * klass)
static void
mpegpsmux_init (MpegPsMux * mux, MpegPsMuxClass * g_class)
{
mux->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get
(&mpegpsmux_src_factory), "src");
mux->srcpad = gst_pad_new_from_static_template (&mpegpsmux_src_factory,
"src");
gst_pad_use_fixed_caps (mux->srcpad);
gst_element_add_pad (GST_ELEMENT (mux), mux->srcpad);

View file

@ -295,14 +295,11 @@ gst_pnmdec_init (GstPnmdec * s, GstPnmdecClass * klass)
GstPad *pad;
pad =
gst_pad_new_from_template (gst_static_pad_template_get
(&gst_pnmdec_sink_pad_template), "sink");
gst_pad_new_from_static_template (&gst_pnmdec_sink_pad_template, "sink");
gst_pad_set_chain_function (pad, gst_pnmdec_chain);
gst_element_add_pad (GST_ELEMENT (s), pad);
pad =
gst_pad_new_from_template (gst_static_pad_template_get
(&gst_pnmdec_src_pad_template), "src");
pad = gst_pad_new_from_static_template (&gst_pnmdec_src_pad_template, "src");
gst_element_add_pad (GST_ELEMENT (s), pad);
}

View file

@ -216,17 +216,13 @@ gst_pnmenc_init (GstPnmenc * s, GstPnmencClass * klass)
{
GstPad *pad;
pad =
gst_pad_new_from_template (gst_static_pad_template_get
(&sink_pad_template), "sink");
pad = gst_pad_new_from_static_template (&sink_pad_template, "sink");
gst_pad_set_setcaps_function (pad, gst_pnmenc_setcaps_func_sink);
gst_pad_set_chain_function (pad, gst_pnmenc_chain);
gst_pad_use_fixed_caps (pad);
gst_element_add_pad (GST_ELEMENT (s), pad);
s->src =
gst_pad_new_from_template (gst_static_pad_template_get
(&src_pad_template), "src");
s->src = gst_pad_new_from_static_template (&src_pad_template, "src");
gst_element_add_pad (GST_ELEMENT (s), s->src);
}