From 95148a5dfda57e72fe13989375f79d37a9f38b61 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Wed, 11 Jun 2025 08:42:22 -0500 Subject: [PATCH] egl/dri/wayland: Fix memory leak in wayland buffer handling In 54c4a41e2d971a794d7aaf05034fe798db17e4be some of the wl_buffers are destroyed without using the loader_wayland_buffer_destroy functions on their wrappers, leaking the wrapper. Fixes 54c4a41e2d971a794d7aaf05034fe798db17e4be Signed-off-by: Derek Foreman Part-of: --- src/egl/drivers/dri2/platform_wayland.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 4a760c17d13..6dc2882f02e 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -865,7 +865,7 @@ dri2_wl_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf) for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { if (dri2_surf->color_buffers[i].wayland_buffer.buffer) - wl_buffer_destroy(dri2_surf->color_buffers[i].wayland_buffer.buffer); + loader_wayland_buffer_destroy(&dri2_surf->color_buffers[i].wayland_buffer); if (dri2_surf->color_buffers[i].dri_image) dri2_destroy_image(dri2_surf->color_buffers[i].dri_image); if (dri2_surf->color_buffers[i].linear_copy) @@ -1441,7 +1441,7 @@ update_buffers(struct dri2_egl_surface *dri2_surf, if (!dri2_surf->color_buffers[i].locked && dri2_surf->color_buffers[i].wayland_buffer.buffer && dri2_surf->color_buffers[i].age > BUFFER_TRIM_AGE_HYSTERESIS) { - wl_buffer_destroy(dri2_surf->color_buffers[i].wayland_buffer.buffer); + loader_wayland_buffer_destroy(&dri2_surf->color_buffers[i].wayland_buffer); dri2_destroy_image(dri2_surf->color_buffers[i].dri_image); if (dri2_dpy->fd_render_gpu != dri2_dpy->fd_display_gpu) dri2_destroy_image(