mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-08 17:08:28 -04:00
AP_Scripting: try a gc on alloc fail in logging
This commit is contained in:
parent
aa8ff87ad2
commit
ff6d9a12a4
@ -171,7 +171,11 @@ 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) {
|
||||
return luaL_error(L, "Buffer allocation failed");
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user