gldisplay: also free the GWeakRef when removing dead contexts
authorMatthew Waters <matthew@centricular.com>
Thu, 22 Sep 2016 08:19:36 +0000 (18:19 +1000)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:32:22 +0000 (19:32 +0000)
Otherwise we leak GWeakRef's.

Found with make -C tests/check libs/gstglcontext.valgrind

gst-libs/gst/gl/gstgldisplay.c

index 7cb6266..3ffc906 100644 (file)
@@ -433,6 +433,7 @@ _get_gl_context_for_thread_unlocked (GstGLDisplay * display, GThread * thread)
     if (!context) {
       /* remove dead contexts */
       g_weak_ref_clear (l->data);
+      g_free (l->data);
       display->priv->contexts = g_list_delete_link (display->priv->contexts, l);
       l = prev ? prev->next : display->priv->contexts;
       continue;