Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c55fa944 authored by Jesse Hall's avatar Jesse Hall
Browse files

libvulkan: Only write vkCreateInstance out parameter on succes

Change-Id: If9f2924caa1c9da4d12eb2d4730e03ea4af0d113
(cherry picked from commit 7adb6e70a83be579e7059ca9fd3b1a2f25d58390)
parent b147127b
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1100,14 +1100,14 @@ VkResult CreateInstance_Top(const VkInstanceCreateInfo* create_info,
        }
    }

    *instance_out = instance->handle;
    VkInstance handle = instance->handle;
    PFN_vkCreateInstance create_instance =
        reinterpret_cast<PFN_vkCreateInstance>(
            next_get_proc_addr(instance->handle, "vkCreateInstance"));
    result = create_instance(create_info, allocator, instance_out);
    result = create_instance(create_info, allocator, &handle);
    if (enable_callback)
        FreeAllocatedCreateInfo(local_create_info, instance->alloc);
    if (result <= 0) {
    if (result < 0) {
        // For every layer, including the loader top and bottom layers:
        // - If a call to the next CreateInstance fails, the layer must clean
        //   up anything it has successfully done so far, and propagate the
@@ -1137,6 +1137,7 @@ VkResult CreateInstance_Top(const VkInstanceCreateInfo* create_info,
                                     allocator, &instance->message);
    }

    *instance_out = instance->handle;
    return result;
}