fix: address multiple bugs across core source files

- zm_analysis_thread.cpp, zm_decoder_thread.cpp: Fix potential deadlock
  in Start() by calling Stop() before joining thread
- zm_camera.cpp: Add null check after avformat_alloc_context()
- zm_comms.cpp: Fix memory leak in InetSocket::bind(), fix error message
  typo in deleteReader(), fix clearReaders/clearWriters to recalculate
  mMaxFd properly
- zm_config.cpp: Fix potential buffer underrun when parsing config files,
  fix misplaced SERVER_ID check logic
- zm_db.cpp: Fix logger level not restored on early return in zmDbDo(),
  fix empty string access in DB_HOST parsing
- zm_event.cpp: Fix typo "foudn" -> "found", fix memory leak with Tag
  allocation, fix variable shadowing with video_file
- zm_event_tag.cpp: Fix null dereference when AssignedBy is NULL
- zm_eventstream.cpp: Fix dangling pointer bugs with emplace_back
  (use auto& instead of auto), fix memory leak in loadInitialEventData

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Isaac Connor
2026-02-03 10:18:49 -05:00
parent cd3e2b5d1e
commit df6c4a4a13
9 changed files with 43 additions and 25 deletions

View File

@@ -14,6 +14,7 @@ DecoderThread::~DecoderThread() {
}
void DecoderThread::Start() {
Stop(); // Signal any running thread to terminate first
if (thread_.joinable()) thread_.join();
terminate_ = false;
thread_ = std::thread(&DecoderThread::Run, this);