initialize packetqueue, analysis_it, storage and videostore in Monitor constructor initializer. Only delete packetqeuue if it has been created.

This commit is contained in:
Isaac Connor 2021-01-15 14:42:26 -05:00
parent 27e10c2ed9
commit 68b0f7e1b5
1 changed files with 8 additions and 2 deletions

View File

@ -355,6 +355,10 @@ Monitor::Monitor()
last_motion_score(0),
camera(nullptr),
event(nullptr),
storage(nullptr),
videoStore(nullptr),
packetqueue(nullptr),
analysis_it(nullptr),
n_zones(0),
zones(nullptr),
timestamps(nullptr),
@ -1145,8 +1149,10 @@ Monitor::~Monitor() {
disconnect();
} // end if mem_ptr
delete packetqueue;
packetqueue = nullptr;
if ( packetqueue ) {
delete packetqueue;
packetqueue = nullptr;
}
analysis_it = nullptr; // deleted by packetqueue
for ( int i = 0; i < n_zones; i++ ) {