mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 16:18:06 +02:00
lavapipe: do not close import fd on error and amend an error code
The implementation only takes the ownership after a successful import.
On import failure, the caller is going to handle the fd. Meanwhile,
amend a missing error code on an error path.
Fixes: 895d3399f7 ("lavapipe: add support for KHR_external_memory_fd")
Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36204>
This commit is contained in:
parent
f1af533b2c
commit
160cd3a317
1 changed files with 1 additions and 2 deletions
|
|
@ -2054,13 +2054,12 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_AllocateMemory(
|
|||
bool dmabuf = import_info->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT;
|
||||
uint64_t size;
|
||||
if(!device->pscreen->import_memory_fd(device->pscreen, import_info->fd, &mem->pmem, &size, dmabuf)) {
|
||||
close(import_info->fd);
|
||||
error = VK_ERROR_INVALID_EXTERNAL_HANDLE;
|
||||
goto fail;
|
||||
}
|
||||
if(size < pAllocateInfo->allocationSize) {
|
||||
device->pscreen->free_memory_fd(device->pscreen, mem->pmem);
|
||||
close(import_info->fd);
|
||||
error = VK_ERROR_INVALID_EXTERNAL_HANDLE;
|
||||
goto fail;
|
||||
}
|
||||
if (export_info && export_info->handleTypes == import_info->handleType) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue