wpe: Properly free property fields
authorJan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com>
Thu, 6 May 2021 16:37:45 +0000 (18:37 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 7 May 2021 16:01:49 +0000 (16:01 +0000)
The set location (in two places) and loaded bytes were not freed when
the element is destroyed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2222>

ext/wpe/WPEThreadedView.cpp
ext/wpe/gstwpesrc.cpp

index 051d103..f4588e5 100644 (file)
@@ -294,12 +294,14 @@ WPEView::WPEView(WebKitWebContext* web_context, GstWpeSrc* src, GstGLContext* co
 
     gst_wpe_src_configure_web_view(src, webkit.view);
 
-    const gchar* location;
+    gchar* location;
     gboolean drawBackground = TRUE;
     g_object_get(src, "location", &location, "draw-background", &drawBackground, nullptr);
     setDrawBackground(drawBackground);
-    if (location)
+    if (location) {
         loadUriUnlocked(location);
+        g_free(location);
+    }
 }
 
 WPEView::~WPEView()
index 2660ae8..750e354 100644 (file)
@@ -666,6 +666,8 @@ gst_wpe_src_finalize (GObject * object)
 {
   GstWpeSrc *src = GST_WPE_SRC (object);
 
+  g_free (src->location);
+  g_clear_pointer (&src->bytes, g_bytes_unref);
   g_mutex_clear (&src->lock);
 
   G_OBJECT_CLASS (parent_class)->finalize (object);