[vlc-devel] [PATCH] opengl: fix destruction order

Romain Vimont rom1v at videolabs.io
Mon Feb 17 17:53:10 CET 2020


The close() callback must be called before module_unneed(), otherwise,
objects allocated by vlc_obj_malloc() will be used-after-free.

Fixes #24234
---
 modules/video_output/opengl/interop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/video_output/opengl/interop.c b/modules/video_output/opengl/interop.c
index 9f39681a60..74b961418f 100644
--- a/modules/video_output/opengl/interop.c
+++ b/modules/video_output/opengl/interop.c
@@ -114,10 +114,10 @@ vlc_gl_interop_New(struct vlc_gl_t *gl, const opengl_vtable_t *vt,
 void
 vlc_gl_interop_Delete(struct vlc_gl_interop *interop)
 {
-    if (interop->module)
-        module_unneed(interop, interop->module);
     if (interop->ops && interop->ops->close)
         interop->ops->close(interop);
+    if (interop->module)
+        module_unneed(interop, interop->module);
     vlc_object_delete(interop);
 }
 
-- 
2.25.0



More information about the vlc-devel mailing list