Mesa (main): egl/wayland: fix surface dma-buf feedback error exits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Dec 2 14:58:23 UTC 2021
Module: Mesa
Branch: main
Commit: 7c57346dfdb3c34229f20ef1c2753d1ac6b4dae0
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c57346dfdb3c34229f20ef1c2753d1ac6b4dae0
Author: Leandro Ribeiro <leandro.ribeiro at collabora.com>
Date: Tue Nov 30 13:40:26 2021 -0300
egl/wayland: fix surface dma-buf feedback error exits
This fixes a leak that was introduced in 89d15b9a "egl/wayland: add
initial dma-buf feedback support".
Do not leak dri2_surf->wl_dmabuf_feedback when we have to bail out
because of allocation issues.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13985>
---
src/egl/drivers/dri2/platform_wayland.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index f714e211f55..7429b05b4b3 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -722,10 +722,15 @@ dri2_wl_create_window_surface(_EGLDisplay *disp, _EGLConfig *conf,
&surface_dmabuf_feedback_listener,
dri2_surf);
- if (dmabuf_feedback_init(&dri2_surf->pending_dmabuf_feedback) < 0)
+ if (dmabuf_feedback_init(&dri2_surf->pending_dmabuf_feedback) < 0) {
+ zwp_linux_dmabuf_feedback_v1_destroy(dri2_surf->wl_dmabuf_feedback);
goto cleanup_surf_wrapper;
- if (dmabuf_feedback_init(&dri2_surf->dmabuf_feedback) < 0)
- goto cleanup_pending_dmabuf_feedback;
+ }
+ if (dmabuf_feedback_init(&dri2_surf->dmabuf_feedback) < 0) {
+ dmabuf_feedback_fini(&dri2_surf->pending_dmabuf_feedback);
+ zwp_linux_dmabuf_feedback_v1_destroy(dri2_surf->wl_dmabuf_feedback);
+ goto cleanup_surf_wrapper;
+ }
if (roundtrip(dri2_dpy) < 0)
goto cleanup_dmabuf_feedback;
@@ -748,7 +753,6 @@ dri2_wl_create_window_surface(_EGLDisplay *disp, _EGLConfig *conf,
if (dri2_surf->wl_dmabuf_feedback) {
zwp_linux_dmabuf_feedback_v1_destroy(dri2_surf->wl_dmabuf_feedback);
dmabuf_feedback_fini(&dri2_surf->dmabuf_feedback);
- cleanup_pending_dmabuf_feedback:
dmabuf_feedback_fini(&dri2_surf->pending_dmabuf_feedback);
}
cleanup_surf_wrapper:
More information about the mesa-commit
mailing list