From b3b5b101cfe8a6ece2b01cbc917d3881e67e364c Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Tue, 19 Dec 2017 08:07:01 +0000 Subject: [PATCH] Merge r225459 - [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): --- Source/WebCore/ChangeLog | 13 +++++++++++++ .../graphics/gstreamer/TextCombinerGStreamer.cpp | 8 +++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 83fa674b7dcd..090ad26ffcae 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,16 @@ +2017-12-03 Carlos Garcia Campos + + [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 [GStreamer] GstCaps leaked in MediaPlayerPrivateGStreamer::createGSTPlayBin diff --git a/Source/WebCore/platform/graphics/gstreamer/TextCombinerGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/TextCombinerGStreamer.cpp index 02de1e8bd7a7..4d33329d131f 100644 --- a/Source/WebCore/platform/graphics/gstreamer/TextCombinerGStreamer.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/TextCombinerGStreamer.cpp @@ -24,9 +24,11 @@ */ #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 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); }