Mesa (main): vulkan/wsi/wayland: memset members of image to zero

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Aug 20 19:10:54 UTC 2021


Module: Mesa
Branch: main
Commit: 8107f671717e7ad86ab3d0675b96153d44f94d05
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8107f671717e7ad86ab3d0675b96153d44f94d05

Author: Leandro Ribeiro <leandro.ribeiro at collabora.com>
Date:   Wed Aug 18 11:43:48 2021 -0300

vulkan/wsi/wayland: memset members of image to zero

struct wsi_wl_image is only used as member of the swapchain, and during
the swapchain creation the image is already initialized to zero. So we
have no problems with members of the image being used uninitialized.

But for consistency, memset the members of this struct to zero in
wsi_wl_image_init(). This can help to avoid problems in the future.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro at collabora.com>
Reviewed-by: Simon Ser <contact at emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12451>

---

 src/vulkan/wsi/wsi_common_wayland.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index 97dd7eec4bf..5e9faa93135 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -1010,6 +1010,8 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,
    struct wsi_wl_display *display = chain->display;
    VkResult result;
 
+   memset(image, 0, sizeof(*image));
+
    result = wsi_create_native_image(&chain->base, pCreateInfo,
                                     chain->num_drm_modifiers > 0 ? 1 : 0,
                                     &chain->num_drm_modifiers,



More information about the mesa-commit mailing list