gldisplay: Fix context leak when removing a context from the display

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/654>
This commit is contained in:
Sebastian Dröge 2020-05-06 16:13:11 +03:00 committed by GStreamer Merge Bot
parent 0fe052db61
commit a0258e3e6b

View file

@ -906,12 +906,13 @@ gst_gl_display_remove_context (GstGLDisplay * display, GstGLContext * needle)
g_weak_ref_clear (l->data); g_weak_ref_clear (l->data);
g_free (l->data); g_free (l->data);
display->priv->contexts = g_list_delete_link (display->priv->contexts, l); display->priv->contexts = g_list_delete_link (display->priv->contexts, l);
l = prev ? prev->next : display->priv->contexts;
if (context) { if (context) {
GST_INFO_OBJECT (display, "removed context %" GST_PTR_FORMAT GST_INFO_OBJECT (display, "removed context %" GST_PTR_FORMAT
" from internal list", context); " from internal list", context);
gst_object_unref (context);
return; return;
} }
l = prev ? prev->next : display->priv->contexts;
continue; continue;
} }
prev = l; prev = l;