mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-07 03:48:14 +00:00
log: Don't stack-allocate the message buffer.
It's 4 kilobytes, so I could see this failing if you have a thread with a tiny stack that unexpectedly logs something.
This commit is contained in:
@@ -282,8 +282,7 @@ SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* !!! FIXME: why not just "char message[SDL_MAX_LOG_MESSAGE];" ? */
|
message = (char *) SDL_malloc(SDL_MAX_LOG_MESSAGE);
|
||||||
message = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE);
|
|
||||||
if (!message) {
|
if (!message) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -300,7 +299,7 @@ SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDL_log_function(SDL_log_userdata, category, priority, message);
|
SDL_log_function(SDL_log_userdata, category, priority, message);
|
||||||
SDL_stack_free(message);
|
SDL_free(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__WIN32__) && !defined(HAVE_STDIO_H) && !defined(__WINRT__)
|
#if defined(__WIN32__) && !defined(HAVE_STDIO_H) && !defined(__WINRT__)
|
||||||
|
Reference in New Issue
Block a user