glcontext/egl: Free dma_formats if someone else already initialized

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9044>
This commit is contained in:
Doug Nazar 2025-05-21 10:04:59 -04:00 committed by GStreamer Marge Bot
parent 99aba78c88
commit 3df63a079c

View File

@ -1762,12 +1762,20 @@ gst_gl_context_egl_fetch_dma_formats (GstGLContext * context)
g_array_sort (dma_formats, _compare_dma_formats);
_print_all_dma_formats (context, dma_formats);
GST_OBJECT_LOCK (context);
egl->dma_formats = dma_formats;
// Are we the first to initialize?
ret = egl->dma_formats == NULL;
if (ret)
egl->dma_formats = dma_formats;
GST_OBJECT_UNLOCK (context);
if (ret) {
_print_all_dma_formats (context, dma_formats);
} else {
// We lost the race...
g_array_unref (dma_formats);
}
g_free (formats);
g_free (modifiers);
g_free (ext_only);