Fix some caps leaks in pad template creation code

gst_pad_template_new() does not take ownership of
the caps passed to it, so we need to unref the caps.

https://bugzilla.gnome.org/show_bug.cgi?id=776790
https://bugzilla.gnome.org/show_bug.cgi?id=776787
This commit is contained in:
Garima Gaur 2017-01-03 09:02:36 +05:30 committed by Tim-Philipp Müller
parent e2fba40038
commit 81b0a14d69
6 changed files with 7 additions and 0 deletions

View file

@ -144,6 +144,7 @@ gst_cv_dilate_erode_class_init (GstCvDilateErodeClass * klass)
gst_element_class_add_pad_template (element_class, templ);
templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
gst_element_class_add_pad_template (element_class, templ);
gst_caps_unref (caps);
}
/* initialize the new element

View file

@ -196,6 +196,7 @@ gst_cv_smooth_class_init (GstCvSmoothClass * klass)
gst_element_class_add_pad_template (element_class, templ);
templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
gst_element_class_add_pad_template (element_class, templ);
gst_caps_unref (caps);
}
/* initialize the new element

View file

@ -232,6 +232,7 @@ gst_frei0r_filter_class_init (GstFrei0rFilterClass * klass,
templ = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, caps);
gst_element_class_add_pad_template (gstelement_class, templ);
gst_caps_unref (caps);
gsttrans_class->set_caps = GST_DEBUG_FUNCPTR (gst_frei0r_filter_set_caps);
gsttrans_class->stop = GST_DEBUG_FUNCPTR (gst_frei0r_filter_stop);

View file

@ -348,6 +348,7 @@ gst_frei0r_src_class_init (GstFrei0rSrcClass * klass,
templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
gst_element_class_add_pad_template (gstelement_class, templ);
gst_caps_unref (caps);
gstbasesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_frei0r_src_set_caps);
gstbasesrc_class->is_seekable =

View file

@ -194,6 +194,7 @@ gst_vtenc_base_init (GstVTEncClass * klass)
src_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
src_caps);
gst_element_class_add_pad_template (element_class, src_template);
gst_caps_unref (src_caps);
}
static void

View file

@ -1233,12 +1233,14 @@ gst_vdp_vpp_class_init (GstVdpVideoPostProcessClass * klass)
src_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
src_caps);
gst_element_class_add_pad_template (gstelement_class, src_template);
gst_caps_unref (src_caps);
/* SINK PAD */
sink_caps = gst_vdp_video_buffer_get_caps (FALSE, 0);
sink_template = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
sink_caps);
gst_element_class_add_pad_template (gstelement_class, sink_template);
gst_caps_unref (sink_caps);
}
static void