AP_BoardConfig: factor substring from allocation_error parameter

This commit is contained in:
Peter Barker 2021-10-11 10:38:43 +11:00 committed by Andrew Tridgell
parent d78f156d6e
commit 5b2eced5a2
1 changed files with 3 additions and 1 deletions

View File

@ -396,7 +396,9 @@ void AP_BoardConfig::allocation_error(const char *fmt, ...)
{
va_list arg_list;
va_start(arg_list, fmt);
throw_error("Allocation Error", fmt, arg_list);
char newfmt[64] {};
snprintf(newfmt, sizeof(newfmt), "Unable to allocate %s", fmt);
throw_error("Allocation Error", newfmt, arg_list);
va_end(arg_list);
}