wpesrc: fix a memory leak of the bytes

free the previous GBytes if load-bytes is called multiple times
before view creation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1663>
This commit is contained in:
Matthew Waters 2020-10-07 21:14:55 +11:00 committed by GStreamer Merge Bot
parent 356fee4dd6
commit da18a8d93d

View file

@ -405,10 +405,13 @@ gst_wpe_src_configure_web_view (GstWpeSrc * src, WebKitWebView * webview)
static void
gst_wpe_src_load_bytes (GstWpeSrc * src, GBytes * bytes)
{
if (src->view && GST_STATE (GST_ELEMENT_CAST (src)) > GST_STATE_NULL)
if (src->view && GST_STATE (GST_ELEMENT_CAST (src)) > GST_STATE_NULL) {
src->view->loadData (bytes);
else
} else {
if (src->bytes)
g_bytes_unref (src->bytes);
src->bytes = g_bytes_ref (bytes);
}
}
static gboolean