libvulkan: Really only write vkCreateInstance out parameter on success

Change-Id: I7efc7dba420565781f15610bbfa7dfd1be1cf84d
(cherry picked from commit 92707024c23b737cad16366ee7380a00e88a797e)
diff --git a/vulkan/libvulkan/loader.cpp b/vulkan/libvulkan/loader.cpp
index ee1e9ac..68ca3c2 100644
--- a/vulkan/libvulkan/loader.cpp
+++ b/vulkan/libvulkan/loader.cpp
@@ -1130,7 +1130,9 @@
     result = create_instance(create_info, allocator, &handle);
     if (enable_callback)
         FreeAllocatedCreateInfo(local_create_info, instance->alloc);
-    if (result < 0) {
+    if (result >= 0) {
+        *instance_out = instance->handle;
+    } else {
         // 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
@@ -1160,7 +1162,6 @@
                                      allocator, &instance->message);
     }
 
-    *instance_out = instance->handle;
     return result;
 }