Commit 1161e47e authored by David Reid's avatar David Reid Committed by GitHub

Merge pull request #343 from Clownacy/dev

Fix `ma_log_postv` not returning anything under certain circumstances
parents 7bb96d8a f56ea204
......@@ -8789,11 +8789,17 @@ MA_API ma_result ma_log_postv(ma_log* pLog, ma_uint32 level, const char* pFormat
formattedLen = ma_vscprintf(&pLog->allocationCallbacks, pFormat, args2);
va_end(args2);
if (formattedLen > 0) {
if (formattedLen <= 0) {
return MA_INVALID_OPERATION;
}
char* pFormattedMessage = NULL;
pFormattedMessage = (char*)ma_malloc(formattedLen + 1, &pLog->allocationCallbacks);
if (pFormattedMessage != NULL) {
if (pFormattedMessage == NULL) {
return MA_OUT_OF_MEMORY;
}
ma_result result;
/* We'll get errors on newer versions of Visual Studio if we try to use vsprintf(). */
......@@ -8812,10 +8818,6 @@ MA_API ma_result ma_log_postv(ma_log* pLog, ma_uint32 level, const char* pFormat
return result;
}
} else {
return MA_INVALID_OPERATION;
}
}
#else
{
/* Can't do anything because we don't have a safe way of to emulate vsnprintf() without a manual solution. */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment