Fix memleak on event creation due to not freeing storage object

This commit is contained in:
Isaac Connor 2021-11-11 13:50:18 -05:00
parent 721769993b
commit 6cd1f6b5f3
1 changed files with 13 additions and 12 deletions

View File

@ -141,7 +141,7 @@ Event::Event(
if (monitor->ServerId()) if (monitor->ServerId())
sql += stringtf(" AND ServerId=%u", monitor->ServerId()); sql += stringtf(" AND ServerId=%u", monitor->ServerId());
Debug(1, "%s", sql.c_str()); delete storage;
storage = nullptr; storage = nullptr;
MYSQL_RES *result = zmDbFetch(sql); MYSQL_RES *result = zmDbFetch(sql);
@ -218,6 +218,7 @@ Event::Event(
Debug(1, "Video file is %s", video_file.c_str()); Debug(1, "Video file is %s", video_file.c_str());
} }
} // end if GetOptVideoWriter } // end if GetOptVideoWriter
delete storage;
} }
Event::~Event() { Event::~Event() {