turnip: Close sync_fd only if it is a valid file descriptor.
Fix defects reported by Coverity Scan.
Argument cannot be negative (NEGATIVE_RETURNS)
negative_returns: sync_fd is passed to a parameter that cannot be negative.
Fixes: cec0bc73e5 ("turnip: rework fences to use syncobjs")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7647>
This commit is contained in:
@@ -282,12 +282,12 @@ tu_RegisterDeviceEventEXT(VkDevice _device,
|
||||
allocator,
|
||||
NULL,
|
||||
sync_fd);
|
||||
|
||||
close(sync_fd);
|
||||
} else {
|
||||
ret = VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
close(sync_fd);
|
||||
|
||||
if (ret != VK_SUCCESS)
|
||||
tu_DestroyFence(_device, *_fence, allocator);
|
||||
|
||||
@@ -319,12 +319,12 @@ tu_RegisterDisplayEventEXT(VkDevice _device,
|
||||
allocator,
|
||||
NULL,
|
||||
sync_fd);
|
||||
|
||||
close(sync_fd);
|
||||
} else {
|
||||
ret = VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
close(sync_fd);
|
||||
|
||||
if (ret != VK_SUCCESS)
|
||||
tu_DestroyFence(_device, *_fence, allocator);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user