diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp index 04b4588d9..c07c9312e 100644 --- a/src/zm_ffmpeg_camera.cpp +++ b/src/zm_ffmpeg_camera.cpp @@ -675,6 +675,11 @@ int FfmpegCamera::Close() { } #endif + if ( videoStore ) { + delete videoStore; + videoStore = NULL; + } + if ( mVideoCodecContext ) { avcodec_close(mVideoCodecContext); Debug(1,"After codec close"); @@ -700,10 +705,6 @@ int FfmpegCamera::Close() { mFormatContext = NULL; } - if ( videoStore ) { - delete videoStore; - videoStore = NULL; - } if ( packetqueue ) { delete packetqueue; packetqueue = NULL;