Check return value of SDL_small_alloc()

Fixes https://github.com/libsdl-org/SDL/issues/8959
This commit is contained in:
Sam Lantinga 2024-10-13 13:17:03 -07:00
parent d7be7fc168
commit 1cc85c912b
9 changed files with 22 additions and 55 deletions

View file

@ -696,6 +696,9 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority
#endif // !defined(SDL_PLATFORM_GDK)
length = SDL_strlen(GetLogPriorityPrefix(priority)) + SDL_strlen(message) + 1 + 1 + 1;
output = SDL_small_alloc(char, length, &isstack);
if (!output) {
return;
}
(void)SDL_snprintf(output, length, "%s%s\r\n", GetLogPriorityPrefix(priority), message);
tstr = WIN_UTF8ToString(output);