Initialize video_sources and audio_sources to prevent crash

This commit is contained in:
Isaac Connor 2021-04-20 09:22:32 -04:00
parent 5f791bce3e
commit ff2017d8b0
1 changed files with 5 additions and 1 deletions

View File

@ -172,12 +172,16 @@ int main(int argc, char *argv[]) {
} }
xop::MediaSession **sessions = new xop::MediaSession *[monitors.size()]; xop::MediaSession **sessions = new xop::MediaSession *[monitors.size()];
for (size_t i = 0; i < monitors.size(); i++) sessions[i] = nullptr;
std::vector<ZoneMinderFifoSource *> video_sources; std::vector<ZoneMinderFifoSource *> video_sources;
video_sources.reserve(monitors.size()); video_sources.reserve(monitors.size());
std::vector<ZoneMinderFifoSource *> audio_sources; std::vector<ZoneMinderFifoSource *> audio_sources;
audio_sources.reserve(monitors.size()); audio_sources.reserve(monitors.size());
for (size_t i = 0; i < monitors.size(); i++) {
sessions[i] = nullptr;
video_sources[i] = nullptr;
audio_sources[i] = nullptr;
}
while (!zm_terminate) { while (!zm_terminate) {
for (size_t i = 0; i < monitors.size(); i++) { for (size_t i = 0; i < monitors.size(); i++) {