egl/dri/wayland: Fix memory leak in wayland buffer handling

In 54c4a41e2d some of the wl_buffers are
destroyed without using the loader_wayland_buffer_destroy functions on
their wrappers, leaking the wrapper.

Fixes 54c4a41e2d

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35466>
This commit is contained in:
Derek Foreman
2025-06-11 08:42:22 -05:00
committed by Marge Bot
parent 1895d6a107
commit 95148a5dfd
+2 -2
View File
@@ -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(