[gst-cvs] gst-plugins-bad: Fix pad template memleaks
David Schleef
ds at kemper.freedesktop.org
Tue Nov 30 18:59:37 PST 2010
Module: gst-plugins-bad
Branch: master
Commit: 159e2768d6729aea2caffb14a6f56a7055d4879f
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=159e2768d6729aea2caffb14a6f56a7055d4879f
Author: David Schleef <ds at schleef.org>
Date: Sat Nov 27 20:13:38 2010 -0800
Fix pad template memleaks
Pad templates returned by gst_static_pad_template_get() were not
being unreffed.
---
ext/dirac/gstdiracdec.cc | 16 +++++++---------
gst/liveadder/liveadder.c | 7 ++-----
gst/mpegpsmux/mpegpsmux.c | 5 ++---
gst/pnm/gstpnmdec.c | 7 ++-----
gst/pnm/gstpnmenc.c | 8 ++------
5 files changed, 15 insertions(+), 28 deletions(-)
diff --git a/ext/dirac/gstdiracdec.cc b/ext/dirac/gstdiracdec.cc
index 597735b..486eab0 100644
--- a/ext/dirac/gstdiracdec.cc
+++ b/ext/dirac/gstdiracdec.cc
@@ -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;
}
diff --git a/gst/liveadder/liveadder.c b/gst/liveadder/liveadder.c
index f92b372..df6cda5 100644
--- a/gst/liveadder/liveadder.c
+++ b/gst/liveadder/liveadder.c
@@ -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,
diff --git a/gst/mpegpsmux/mpegpsmux.c b/gst/mpegpsmux/mpegpsmux.c
index 70f0213..d64fb35 100644
--- a/gst/mpegpsmux/mpegpsmux.c
+++ b/gst/mpegpsmux/mpegpsmux.c
@@ -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);
diff --git a/gst/pnm/gstpnmdec.c b/gst/pnm/gstpnmdec.c
index 060af2d..394e86d 100644
--- a/gst/pnm/gstpnmdec.c
+++ b/gst/pnm/gstpnmdec.c
@@ -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);
}
diff --git a/gst/pnm/gstpnmenc.c b/gst/pnm/gstpnmenc.c
index a197e6f..53bd4a3 100644
--- a/gst/pnm/gstpnmenc.c
+++ b/gst/pnm/gstpnmenc.c
@@ -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);
}
More information about the Gstreamer-commits
mailing list