Don't do NULL-checks before SDL_free()

Replaces the pattern

  if (ptr) {
    SDL_free(ptr);
  }

with

  SDL_free(ptr);
This commit is contained in:
Eddy Jansson
2025-10-19 11:07:48 +02:00
committed by Sam Lantinga
parent 2f810e0a5f
commit aaee09d6ed
40 changed files with 76 additions and 229 deletions

View File

@@ -4958,9 +4958,7 @@ static void VULKAN_DestroyDevice(
j);
}
if (renderer->memoryAllocator->subAllocators[i].allocations != NULL) {
SDL_free(renderer->memoryAllocator->subAllocators[i].allocations);
}
SDL_free(renderer->memoryAllocator->subAllocators[i].allocations);
SDL_free(renderer->memoryAllocator->subAllocators[i].sortedFreeRegions);
}
@@ -6987,9 +6985,7 @@ static void VULKAN_ReleaseTexture(
SDL_DestroyProperties(vulkanTextureContainer->header.info.props);
// Containers are just client handles, so we can destroy immediately
if (vulkanTextureContainer->debugName != NULL) {
SDL_free(vulkanTextureContainer->debugName);
}
SDL_free(vulkanTextureContainer->debugName);
SDL_free(vulkanTextureContainer->textures);
SDL_free(vulkanTextureContainer);