Browse Source
la_mojo: fix memory leaks and heap corruption
la_mojo: fix memory leaks and heap corruption
Continuous leaks: - protocolParser: on package-pool overflow the oldest package was removed but never freed while the newest (still pooled) one was freed. Every packet a handler does not consume (e.g. other sensors on a shared bus) leaked once the pool was full. Free the removed package, free pooled packages in the destructor and getPackage(), use memmove for the overlapping buffer shifts. - SQLite_Connector::Query: loop only while sqlite3_step() returns SQLITE_ROW. Looping until SQLITE_DONE spun forever allocating rows on SQLITE_BUSY/ERROR. Set a busy timeout, close handles after a failed open, fix escapeBinary() writing into uninitialised buffers. - basicThread/basicDualThread: threads that ended by themselves were never joined, leaking their stacks on every stream drop/restart. Always join once (detach when called from the thread itself); check pthread_create result correctly. - curlRequest: free the header list; initialise m_pPostData and the content type; curlRequestsManager deletes requests it cannot queue. - kernelModuleModemManager: free the phonebook ID list on every reload. - deviceNodeFactory: do not append the same pending node every cycle. - streamHandler: free frames left in the encoding queue on destruction. Heap corruption: - kernelModuleFactory: module that failed to start was deleted twice. - mojoRemoteClient: basicRing::push() returns an ID (may be 0), not a bool; compare with -1. Fix packetExtractor and destructor leaks. - utilizeBasicEvent: payloads are malloc'ed, release with free(). - videoAVLIBSource: avoid sws context double free, NULL check order. - trim(): memmove for overlapping copy. Smaller leaks: dropSession duplicate query, LRF upload data, report backupper / fly hunter settings, Kafka consumer handle, BVMS uniq ID. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16pull/7/head
Failed to extract signature
23 changed files with 260 additions and 53 deletions
-
2lib/App/common/SQLite_dataBinder.cpp
-
1lib/App/common/deviceNode2D.cpp
-
10lib/App/common/deviceNodeFactory.cpp
-
4lib/App/common/kernelModuleFactory.cpp
-
1lib/App/common/kernelModuleFlyHunter.cpp
-
1lib/App/common/kernelModuleModemManager.cpp
-
1lib/App/common/kernelModuleReportBackupper.cpp
-
26lib/App/common/streamHandler.cpp
-
21lib/App/mojo/mojoRemoteClient.cpp
-
46lib/components/base/basicDualThread.cpp
-
10lib/components/base/basicDualThread.h
-
22lib/components/base/basicEvent.cpp
-
2lib/components/base/basicFunctionality.cpp
-
30lib/components/base/basicThread.cpp
-
6lib/components/base/basicThread.h
-
28lib/data/curl/curlRequest.cpp
-
3lib/data/curl/curlRequestsManager.cpp
-
6lib/data/media/video/videoAVLIBSource.cpp
-
33lib/data/protocol/protocol.cpp
-
10lib/data/protocol/protocolBVMS.cpp
-
10lib/data/protocol/protocolKAFKA.cpp
-
35lib/data/sqlite/sqlite_class.cpp
-
5lib/data/sqlite/sqlite_class.h
Write
Preview
Loading…
Cancel
Save
Reference in new issue