mirror of https://github.com/ArduPilot/ardupilot
AP_Scripting: try a gc on alloc fail in logging
This commit is contained in:
parent
aa8ff87ad2
commit
ff6d9a12a4
|
@ -170,9 +170,13 @@ int AP_Logger_Write(lua_State *L) {
|
|||
|
||||
lua_Alloc allocf = lua_getallocf(L, nullptr);
|
||||
char *buffer = (char*)allocf(nullptr, nullptr, 0, msg_len);
|
||||
if (buffer == nullptr) {
|
||||
lua_gc(L, LUA_GCCOLLECT, 0);
|
||||
buffer = (char*)allocf(nullptr, nullptr, 0, msg_len);
|
||||
if (buffer == nullptr) {
|
||||
return luaL_error(L, "Buffer allocation failed");
|
||||
}
|
||||
}
|
||||
|
||||
// add logging headers
|
||||
uint8_t offset = 0;
|
||||
|
|
Loading…
Reference in New Issue