[0.11] gst-ffmpeg: ffmpeg: fix pad template ref leaks

Sebastian Dröge slomo at kemper.freedesktop.org
Tue Jan 10 02:39:45 PST 2012


Module: gst-ffmpeg
Branch: 0.11
Commit: dcd387b3136bc774a221a8e85ff9129233841260
URL:    http://cgit.freedesktop.org/gstreamer/gst-ffmpeg/commit/?id=dcd387b3136bc774a221a8e85ff9129233841260

Author: Vincent Penquerc'h <vincent.penquerch at collabora.co.uk>
Date:   Mon Nov 28 13:23:42 2011 +0000

ffmpeg: fix pad template ref leaks

https://bugzilla.gnome.org/show_bug.cgi?id=662664

---

 ext/ffmpeg/gstffmpegaudioresample.c |    6 ++----
 ext/ffmpeg/gstffmpegdeinterlace.c   |    6 ++----
 ext/ffmpeg/gstffmpegmux.c           |    3 +++
 ext/ffmpeg/gstffmpegscale.c         |    6 ++----
 ext/libpostproc/gstpostproc.c       |    8 ++++----
 ext/libswscale/gstffmpegscale.c     |    6 ++----
 6 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/ext/ffmpeg/gstffmpegaudioresample.c b/ext/ffmpeg/gstffmpegaudioresample.c
index 321a008..b63068d 100644
--- a/ext/ffmpeg/gstffmpegaudioresample.c
+++ b/ext/ffmpeg/gstffmpegaudioresample.c
@@ -103,10 +103,8 @@ gst_ffmpegaudioresample_base_init (gpointer g_class)
 {
   GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
 
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_factory));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sink_factory));
+  gst_element_class_add_static_pad_template (element_class, &src_factory);
+  gst_element_class_add_static_pad_template (element_class, &sink_factory);
   gst_element_class_set_details_simple (element_class,
       "FFMPEG Audio resampling element", "Filter/Converter/Audio",
       "Converts audio from one samplerate to another",
diff --git a/ext/ffmpeg/gstffmpegdeinterlace.c b/ext/ffmpeg/gstffmpegdeinterlace.c
index de95314..40fea5e 100644
--- a/ext/ffmpeg/gstffmpegdeinterlace.c
+++ b/ext/ffmpeg/gstffmpegdeinterlace.c
@@ -145,10 +145,8 @@ gst_ffmpegdeinterlace_base_init (gpointer g_class)
 {
   GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
 
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_factory));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sink_factory));
+  gst_element_class_add_static_pad_template (element_class, &src_factory);
+  gst_element_class_add_static_pad_template (element_class, &sink_factory);
   gst_element_class_set_details_simple (element_class,
       "FFMPEG Deinterlace element", "Filter/Effect/Video/Deinterlace",
       "Deinterlace video", "Luca Ognibene <luogni at tin.it>");
diff --git a/ext/ffmpeg/gstffmpegmux.c b/ext/ffmpeg/gstffmpegmux.c
index 538aeed..a041761 100644
--- a/ext/ffmpeg/gstffmpegmux.c
+++ b/ext/ffmpeg/gstffmpegmux.c
@@ -272,17 +272,20 @@ gst_ffmpegmux_base_init (gpointer g_class)
   /* pad templates */
   srctempl = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, srccaps);
   gst_element_class_add_pad_template (element_class, srctempl);
+  gst_object_unref (srctempl);
 
   if (audiosinkcaps) {
     audiosinktempl = gst_pad_template_new ("audio_%d",
         GST_PAD_SINK, GST_PAD_REQUEST, audiosinkcaps);
     gst_element_class_add_pad_template (element_class, audiosinktempl);
+    gst_object_unref (audiosinktempl);
   }
 
   if (videosinkcaps) {
     videosinktempl = gst_pad_template_new ("video_%d",
         GST_PAD_SINK, GST_PAD_REQUEST, videosinkcaps);
     gst_element_class_add_pad_template (element_class, videosinktempl);
+    gst_object_unref (videosinktempl);
   }
 
 beach:
diff --git a/ext/ffmpeg/gstffmpegscale.c b/ext/ffmpeg/gstffmpegscale.c
index a8678ae..ac5c7e1 100644
--- a/ext/ffmpeg/gstffmpegscale.c
+++ b/ext/ffmpeg/gstffmpegscale.c
@@ -103,10 +103,8 @@ gst_ffmpegscale_base_init (gpointer g_class)
 {
   GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
 
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_factory));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sink_factory));
+  gst_element_class_add_static_pad_template (element_class, &src_factory);
+  gst_element_class_add_static_pad_template (element_class, &sink_factory);
   gst_element_class_set_details_simple (element_class, "FFMPEG Scale element",
       "Filter/Converter/Video/Scaler",
       "Converts video from one resolution to another",
diff --git a/ext/libpostproc/gstpostproc.c b/ext/libpostproc/gstpostproc.c
index f9ddcdd..963b77d 100644
--- a/ext/libpostproc/gstpostproc.c
+++ b/ext/libpostproc/gstpostproc.c
@@ -381,10 +381,10 @@ gst_post_proc_base_init (GstPostProcClass * klass)
   g_free (longname);
   g_free (description);
 
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_post_proc_src_template));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_post_proc_sink_template));
+  gst_element_class_add_static_pad_template (element_class,
+      &gst_post_proc_src_template);
+  gst_element_class_add_static_pad_template (element_class,
+      &gst_post_proc_sink_template);
 
   klass->filterid = ppidx;
 }
diff --git a/ext/libswscale/gstffmpegscale.c b/ext/libswscale/gstffmpegscale.c
index 202fda8..050a962 100644
--- a/ext/libswscale/gstffmpegscale.c
+++ b/ext/libswscale/gstffmpegscale.c
@@ -190,10 +190,8 @@ gst_ffmpegscale_base_init (gpointer g_class)
 {
   GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
 
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_factory));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sink_factory));
+  gst_element_class_add_static_pad_template (element_class, &src_factory);
+  gst_element_class_add_static_pad_template (element_class, &sink_factory);
   gst_element_class_set_details_simple (element_class, "FFMPEG Scale element",
       "Filter/Converter/Video",
       "Converts video from one resolution to another",



More information about the gstreamer-commits mailing list