Skip to content

Commit

Permalink
Fixed possible memset(NULL) call in testautomation's SDL_aligned_allo…
Browse files Browse the repository at this point in the history
…c() check

Fixes #11144
  • Loading branch information
slouken committed Oct 10, 2024
1 parent 4b7c5f5 commit 8262072
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/testautomation_stdlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8262072

Please sign in to comment.