On Sun, 22 Oct 2017, Tom Parker wrote:
I found a very odd bug, if you make a script which calls a command that doesn't log anything, you get a crash in ovms_console.cpp. It took me quite some time to trace this to commands that don't log, because start and stop do log if they're called in the right order, but my terrible network manager would call start whenever the network came up which would die the second time because the v2 client is already running and doesn't log anything if you try to start it again.
When the code in ovms_console was written it was not possible for a LogBuffers object to have no buffers because it was only created at the same time as the first buffer was inserted. When I began using LogBuffers to collect the output of BufferedShell, this was no longer true. I fixed the crash by checking for the empty case. A second commit was required because the first one resulted in leaking the empty LogBuffers. However, while checking about that leak I see what looks like a leak of another 108-byte block every time the tick script runs. I have not identified that yet. Also, I think if I call the tick script from another one I can get a different (related) crash. About to test that one. -- Steve