[Mesa-dev] [PATCH mesa] vulkan: don't free uninitialised memory
Lionel Landwerlin
lionel.g.landwerlin at intel.com
Tue May 22 17:16:48 UTC 2018
On 22/05/18 18:02, Eric Engestrom wrote:
> The modifiers array hasn't been initialised by then, much less with data
> that would need freeing.
> Move the label after the loop to fix this.
>
> Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Fixes: c80c08e22603 ("vulkan/wsi/x11: Add support for DRI3 v1.2")
> ---
> src/vulkan/wsi/wsi_common_x11.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
> index 62739b99125412ec9d73..1bfbc7c30019a63b6599 100644
> --- a/src/vulkan/wsi/wsi_common_x11.c
> +++ b/src/vulkan/wsi/wsi_common_x11.c
> @@ -1421,10 +1421,10 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
> for (uint32_t j = 0; j < image; j++)
> x11_image_finish(chain, pAllocator, &chain->images[j]);
>
> + for (int i = 0; i < ARRAY_SIZE(modifiers); i++)
> + vk_free(pAllocator, modifiers[i]);
> +
> fail_register:
> - for (int i = 0; i < ARRAY_SIZE(modifiers); i++)
> - vk_free(pAllocator, modifiers[i]);
> -
> xcb_unregister_for_special_event(chain->conn, chain->special_event);
>
> wsi_swapchain_finish(&chain->base);
More information about the mesa-dev
mailing list