From c9a04ca979d004114f7df2ceb18bd74d1b191df8 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Thu, 6 May 2021 18:37:45 +0200 Subject: [PATCH] wpe: Properly free property fields The set location (in two places) and loaded bytes were not freed when the element is destroyed. Part-of: --- ext/wpe/WPEThreadedView.cpp | 6 ++++-- ext/wpe/gstwpesrc.cpp | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ext/wpe/WPEThreadedView.cpp b/ext/wpe/WPEThreadedView.cpp index 051d103..f4588e5 100644 --- a/ext/wpe/WPEThreadedView.cpp +++ b/ext/wpe/WPEThreadedView.cpp @@ -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() diff --git a/ext/wpe/gstwpesrc.cpp b/ext/wpe/gstwpesrc.cpp index 2660ae8..750e354 100644 --- a/ext/wpe/gstwpesrc.cpp +++ b/ext/wpe/gstwpesrc.cpp @@ -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); -- 2.7.4