[GStreamer] GstPad leaked in WebKitTextCombiner
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 3 Dec 2017 09:08:42 +0000 (09:08 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 3 Dec 2017 09:08:42 +0000 (09:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=180314

Reviewed by Michael Catanzaro.

gst_element_get_static_pad() returns a full reference that si never freed, because gst_ghost_pad_new doesn't
take the ownership of the given pad.

* platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
(webkit_text_combiner_init):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225459 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/TextCombinerGStreamer.cpp

index 6371a2c..1d3f962 100644 (file)
@@ -1,5 +1,18 @@
 2017-12-03  Carlos Garcia Campos  <cgarcia@igalia.com>
 
+        [GStreamer] GstPad leaked in WebKitTextCombiner
+        https://bugs.webkit.org/show_bug.cgi?id=180314
+
+        Reviewed by Michael Catanzaro.
+
+        gst_element_get_static_pad() returns a full reference that si never freed, because gst_ghost_pad_new doesn't
+        take the ownership of the given pad.
+
+        * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
+        (webkit_text_combiner_init):
+
+2017-12-03  Carlos Garcia Campos  <cgarcia@igalia.com>
+
         [GStreamer] GstCaps leaked in MediaPlayerPrivateGStreamer::createGSTPlayBin
         https://bugs.webkit.org/show_bug.cgi?id=180311
 
index 02de1e8..4d33329 100644 (file)
  */
 
 #include "config.h"
+#include "TextCombinerGStreamer.h"
+
 #if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(VIDEO_TRACK)
 
-#include "TextCombinerGStreamer.h"
+#include "GRefPtrGStreamer.h"
 
 static GstStaticPadTemplate sinkTemplate =
     GST_STATIC_PAD_TEMPLATE("sink_%u", GST_PAD_SINK, GST_PAD_REQUEST,
@@ -83,10 +85,10 @@ static void webkit_text_combiner_init(WebKitTextCombiner* combiner)
     UNUSED_PARAM(ret);
     ASSERT(ret);
 
-    GstPad* pad = gst_element_get_static_pad(combiner->funnel, "src");
+    GRefPtr<GstPad> pad = adoptGRef(gst_element_get_static_pad(combiner->funnel, "src"));
     ASSERT(pad);
 
-    ret = gst_element_add_pad(GST_ELEMENT(combiner), gst_ghost_pad_new("src", pad));
+    ret = gst_element_add_pad(GST_ELEMENT(combiner), gst_ghost_pad_new("src", pad.get()));
     ASSERT(ret);
 }