ui/egl: fix render node cleanup order
PATCH 1/1 ui/egl: fix render node cleanup order
From: Marc-André Lureau <[email protected]>
ASAN detected some memory leaks when terminating. Release thread-bound EGL state first, destroy the context and terminate the display while the GBM device is still alive, then destroy GBM and close the render-node fd.
Signed-off-by Marc-André Lureau <[email protected]>
--- ui/egl-helpers.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
ui/egl-helpers.c +9 -6
@@ -736,19 +736,22 @@ bool egl_init(const char *rendernode, DisplayGLMode mode, Error **errp)void egl_cleanup (void ) { +if (qemu_egl_display) { +eglReleaseThread (); + } +if (qemu_egl_rn_ctx) {eglDestroyContext (qemu_egl_display, qemu_egl_rn_ctx); qemu_egl_rn_ctx =NULL ; } +if (qemu_egl_display) { +eglTerminate (qemu_egl_display); + qemu_egl_display =NULL ; + } +#ifdef CONFIG_GBM g_clear_pointer (&qemu_egl_rn_gbm_dev, gbm_device_destroy);g_clear_fd (&qemu_egl_rn_fd,NULL );#endif - -if (qemu_egl_display) { -eglReleaseThread (); -eglTerminate (qemu_egl_display); - qemu_egl_display =NULL ; - } }
Signature · 1 line
2.55.0.543.g5ebe2ebe4ea8
Quoted 8 lines · On 2026/08/20 22:20, [email protected] wrote:
From: Marc-André Lureau <[email protected]>
ASAN detected some memory leaks when terminating. Release thread-bound EGL state first, destroy the context and terminate the display while the GBM device is still alive, then destroy GBM and close the render-node fd.
Signed-off-by Marc-André Lureau <[email protected]>
Reviewed-by Akihiko Odaki <[email protected]>
You may also add:
Fixes a3cf9b55bbdc ("ui/egl: implement display and EGL cleanup")
Regards,
Akihiko Odaki