From 9d636ad12829ffc86f6cf916ed21ea961b9c894a Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 29 Jan 2015 15:32:50 -0500 Subject: [PATCH] fix zms crash due to buffer_copy_size never being initialized --- src/zm_mpeg.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/zm_mpeg.cpp b/src/zm_mpeg.cpp index 60bb22c1d..1cd469ccc 100644 --- a/src/zm_mpeg.cpp +++ b/src/zm_mpeg.cpp @@ -391,6 +391,9 @@ void VideoStream::OpenStream( ) // TODO: Make buffer dynamic. video_outbuf_size = 4000000; video_outbuf = (uint8_t *)malloc( video_outbuf_size ); + if ( video_outbuf == NULL ) { + Fatal("Unable to malloc memory for outbuf"); + } } #if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 100, 1) @@ -417,6 +420,7 @@ VideoStream::VideoStream( const char *in_filename, const char *in_format, int bi last_pts( -1 ), streaming_thread(0), do_streaming(true), + buffer_copy_size(0), buffer_copy(NULL), buffer_copy_lock(new pthread_mutex_t), buffer_copy_used(0),