Fixed possible memset(NULL) call in testautomation's SDL_aligned_alloc() check

Fixes https://github.com/libsdl-org/SDL/issues/11144
This commit is contained in:
Sam Lantinga 2024-10-10 07:59:32 -07:00
parent 4b7c5f561b
commit 8262072d91
1 changed files with 5 additions and 3 deletions

View File

@ -913,9 +913,11 @@ static int SDLCALL stdlib_aligned_alloc(void *arg)
}
SDLTest_AssertCheck(ptr != NULL, "Check output, expected non-NULL, got: %p", ptr);
SDLTest_AssertCheck((((size_t)ptr) % alignment) == 0, "Check output, expected aligned pointer, actual offset: %"SIZE_FORMAT, (((size_t)ptr) % alignment));
SDLTest_AssertPass("Filling memory to alignment value");
SDL_memset(ptr, 0xAA, alignment);
SDL_aligned_free(ptr);
if (ptr != NULL) {
SDLTest_AssertPass("Filling memory to alignment value");
SDL_memset(ptr, 0xAA, alignment);
SDL_aligned_free(ptr);
}
}
return TEST_COMPLETED;