diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index e5d8b3b568d..1a8a3197427 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -1620,6 +1620,9 @@ anv_cmd_buffer_execbuf(struct anv_device *device, assert(!pdevice->has_syncobj); if (in_fence == -1) { in_fence = impl->fd; + if (in_fence == -1) + return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); + impl->fd = -1; } else { int merge = anv_gem_sync_file_merge(device, in_fence, impl->fd); if (merge == -1) @@ -1627,10 +1630,9 @@ anv_cmd_buffer_execbuf(struct anv_device *device, close(impl->fd); close(in_fence); + impl->fd = -1; in_fence = merge; } - - impl->fd = -1; break; case ANV_SEMAPHORE_TYPE_DRM_SYNCOBJ: