File webkit2gtk3-glib268.patch of Package webkit2gtk3.36120

From e6024502b5ca9beca469edbd615db07c5fc017a5 Mon Sep 17 00:00:00 2001
From: Miguel Gomez <magomez@igalia.com>
Date: Thu, 5 Sep 2024 09:28:02 -0700
Subject: [PATCH] [GTK][WPE][GStreamer] Fix build with glib < 2.68
 https://bugs.webkit.org/show_bug.cgi?id=279177

Reviewed by Philippe Normand and Michael Catanzaro.

Replace the usage of g_memdup2 with an equivalent code.

* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:
(gst_buffer_new_memdup):

Canonical link: https://commits.webkit.org/283216@main
---
 .../platform/graphics/gstreamer/GStreamerCommon.cpp        | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp b/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp
index f67268dfb62d..9078f1f35b54 100644
--- a/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp
+++ b/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp
@@ -1557,7 +1557,12 @@ std::optional<unsigned> gstGetAutoplugSelectResult(ASCIILiteral nick)
 #if !GST_CHECK_VERSION(1, 20, 0)
 GstBuffer* gst_buffer_new_memdup(gconstpointer data, gsize size)
 {
-    gpointer copiedData = g_memdup2(data, size);
+    gpointer copiedData = nullptr;
+
+    if (data && size) {
+        copiedData = g_malloc(size);
+        memcpy(copiedData, data, size);
+    }
 
     return gst_buffer_new_wrapped_full(static_cast<GstMemoryFlags>(0), copiedData, size, 0, size, copiedData, g_free);
 }
-- 
2.46.0

openSUSE Build Service is sponsored by