Skip to content

Commit 77f4a8e

Browse files
Sackzementslouken
authored andcommitted
Fix potential memory leak in VULKAN_AcquireCommandBuffer() on error
1 parent fb1d1ab commit 77f4a8e

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/gpu/vulkan/SDL_gpu_vulkan.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9548,15 +9548,16 @@ static SDL_GPUCommandBuffer *VULKAN_AcquireCommandBuffer(
95489548
VulkanCommandBuffer *commandBuffer =
95499549
VULKAN_INTERNAL_GetInactiveCommandBufferFromPool(renderer, threadID);
95509550

9551+
if (commandBuffer == NULL) {
9552+
SDL_UnlockMutex(renderer->acquireCommandBufferLock);
9553+
return NULL;
9554+
}
9555+
95519556
DescriptorSetCache *descriptorSetCache =
95529557
VULKAN_INTERNAL_AcquireDescriptorSetCache(renderer);
95539558

95549559
SDL_UnlockMutex(renderer->acquireCommandBufferLock);
95559560

9556-
if (commandBuffer == NULL) {
9557-
return NULL;
9558-
}
9559-
95609561
commandBuffer->descriptorSetCache = descriptorSetCache;
95619562

95629563
// Reset state

0 commit comments

Comments
 (0)