From ff2017d8b096ee0d97bce59aa539024355e498c7 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 20 Apr 2021 09:22:32 -0400 Subject: [PATCH] Initialize video_sources and audio_sources to prevent crash --- src/zm_rtsp_server.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/zm_rtsp_server.cpp b/src/zm_rtsp_server.cpp index 0e5eacbae..339ffe2f9 100644 --- a/src/zm_rtsp_server.cpp +++ b/src/zm_rtsp_server.cpp @@ -172,12 +172,16 @@ int main(int argc, char *argv[]) { } xop::MediaSession **sessions = new xop::MediaSession *[monitors.size()]; - for (size_t i = 0; i < monitors.size(); i++) sessions[i] = nullptr; std::vector video_sources; video_sources.reserve(monitors.size()); std::vector audio_sources; 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) { for (size_t i = 0; i < monitors.size(); i++) {