vulkan: don't free uninitialised memory
authorEric Engestrom <eric.engestrom@intel.com>
Fri, 18 May 2018 16:12:53 +0000 (17:12 +0100)
committerEric Engestrom <eric.engestrom@intel.com>
Tue, 29 May 2018 16:44:13 +0000 (17:44 +0100)
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.

Fixes: c80c08e22603 ("vulkan/wsi/x11: Add support for DRI3 v1.2")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/vulkan/wsi/wsi_common_x11.c

index 62739b99125412ec9d73f1cf5861f9dd97af113d..1bfbc7c30019a63b65992fc961d334485fba0004 100644 (file)
@@ -1421,10 +1421,10 @@ fail_init_images:
    for (uint32_t j = 0; j < image; j++)
       x11_image_finish(chain, pAllocator, &chain->images[j]);
 
-fail_register:
    for (int i = 0; i < ARRAY_SIZE(modifiers); i++)
       vk_free(pAllocator, modifiers[i]);
 
+fail_register:
    xcb_unregister_for_special_event(chain->conn, chain->special_event);
 
    wsi_swapchain_finish(&chain->base);