ardupilot
ardupilot copied to clipboard
AP_Scripting: fix and polish logger:write
The main change is to a stack-allocated buffer. We did not leak the heap buffer, but we did not tell Lua its size upon freeing it, thereby screwing up internal accounting and creating the impression of a leak. We don't use the problematic luaM_free anywhere else.
While I was in there I also did some other nice things to make it more efficient. Saves a couple hundred bytes on Cube Orange. Tested that the calls in our little logging example still work and the dataflash log contains the right values.
Supersedes #31652 (who reported the original possible leak)