Title: [236721] trunk/Source/WebCore
Revision
236721
Author
ph...@webkit.org
Date
2018-10-02 02:43:51 -0700 (Tue, 02 Oct 2018)

Log Message

[GStreamer][playbin3] Stream tag lists leaks
https://bugs.webkit.org/show_bug.cgi?id=190192

Reviewed by Xabier Rodriguez-Calvar.

The gst_stream_get_tags() result is transfer-full, so needs to be adopted to prevent a leak.
Also check the tags list pointer which might be NULL in some cases.

* platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
(WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::naturalSize const):
* platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
(WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (236720 => 236721)


--- trunk/Source/WebCore/ChangeLog	2018-10-02 09:32:00 UTC (rev 236720)
+++ trunk/Source/WebCore/ChangeLog	2018-10-02 09:43:51 UTC (rev 236721)
@@ -1,3 +1,20 @@
+2018-10-02  Philippe Normand  <pnorm...@igalia.com>
+
+        [GStreamer][playbin3] Stream tag lists leaks
+        https://bugs.webkit.org/show_bug.cgi?id=190192
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        The gst_stream_get_tags() result is transfer-full, so needs to be adopted to prevent a leak.
+        Also check the tags list pointer which might be NULL in some cases.
+
+        * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
+        (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::naturalSize const):
+        * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
+        (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
+
 2018-10-01  Michael Catanzaro  <mcatanz...@igalia.com>
 
         Unreviewed, fix unused variable in RenderLayer::updateScrollableAreaSet

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp (236720 => 236721)


--- trunk/Source/WebCore/platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp	2018-10-02 09:32:00 UTC (rev 236720)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp	2018-10-02 09:43:51 UTC (rev 236721)
@@ -49,9 +49,9 @@
     , m_player(player)
 {
     gint kind;
-    auto tags = gst_stream_get_tags(m_stream.get());
+    auto tags = adoptGRef(gst_stream_get_tags(m_stream.get()));
 
-    if (gst_tag_list_get_int(tags, "webkit-media-stream-kind", &kind) && kind == static_cast<int>(VideoTrackPrivate::Kind::Main)) {
+    if (tags && gst_tag_list_get_int(tags.get(), "webkit-media-stream-kind", &kind) && kind == static_cast<int>(VideoTrackPrivate::Kind::Main)) {
         GstStreamFlags streamFlags = gst_stream_get_stream_flags(stream.get());
         gst_stream_set_stream_flags(stream.get(), static_cast<GstStreamFlags>(streamFlags | GST_STREAM_FLAG_SELECT));
     }

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (236720 => 236721)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2018-10-02 09:32:00 UTC (rev 236720)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2018-10-02 09:43:51 UTC (rev 236721)
@@ -672,10 +672,10 @@
         RefPtr<VideoTrackPrivateGStreamer> videoTrack = m_videoTracks.get(m_currentVideoStreamId);
 
         if (videoTrack) {
-            auto tags = gst_stream_get_tags(videoTrack->stream());
+            auto tags = adoptGRef(gst_stream_get_tags(videoTrack->stream()));
             gint width, height;
 
-            if (gst_tag_list_get_int(tags, WEBKIT_MEDIA_TRACK_TAG_WIDTH, &width) && gst_tag_list_get_int(tags, WEBKIT_MEDIA_TRACK_TAG_HEIGHT, &height))
+            if (tags && gst_tag_list_get_int(tags.get(), WEBKIT_MEDIA_TRACK_TAG_WIDTH, &width) && gst_tag_list_get_int(tags.get(), WEBKIT_MEDIA_TRACK_TAG_HEIGHT, &height))
                 return FloatSize(width, height);
         }
     }

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp (236720 => 236721)


--- trunk/Source/WebCore/platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp	2018-10-02 09:32:00 UTC (rev 236720)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp	2018-10-02 09:43:51 UTC (rev 236721)
@@ -49,9 +49,9 @@
     , m_player(player)
 {
     gint kind;
-    auto tags = gst_stream_get_tags(m_stream.get());
+    auto tags = adoptGRef(gst_stream_get_tags(m_stream.get()));
 
-    if (gst_tag_list_get_int(tags, "webkit-media-stream-kind", &kind) && kind == static_cast<int>(VideoTrackPrivate::Kind::Main)) {
+    if (tags && gst_tag_list_get_int(tags.get(), "webkit-media-stream-kind", &kind) && kind == static_cast<int>(VideoTrackPrivate::Kind::Main)) {
         GstStreamFlags streamFlags = gst_stream_get_stream_flags(stream.get());
         gst_stream_set_stream_flags(stream.get(), static_cast<GstStreamFlags>(streamFlags | GST_STREAM_FLAG_SELECT));
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to