[vlc-commits] opengl: fix destruction order

Romain Vimont git at videolan.org
Sun Feb 23 15:29:12 CET 2020


vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Mon Feb 17 17:53:10 2020 +0100| [7e45ce925b8c74958656546e5d1395b2e48f85ee] | committer: Rémi Denis-Courmont

opengl: fix destruction order

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

Fixes #24234

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7e45ce925b8c74958656546e5d1395b2e48f85ee
---

 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);
 }
 



More information about the vlc-commits mailing list