From 558aed0561d58e451ed7f539a7d1a42433754605 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 26 Oct 2023 13:44:02 -0400 Subject: [PATCH] Fix memleak due to not freeing the opts dict except on error. --- src/zm_ffmpeg_camera.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp index 03db44246..a7f11197f 100644 --- a/src/zm_ffmpeg_camera.cpp +++ b/src/zm_ffmpeg_camera.cpp @@ -517,9 +517,9 @@ int FfmpegCamera::OpenFfmpeg() { while ((e = av_dict_get(opts, "", e, AV_DICT_IGNORE_SUFFIX)) != nullptr) { Warning("Option %s not recognized by ffmpeg", e->key); } + av_dict_free(&opts); if (ret < 0) { Error("Unable to open codec for video stream from %s", mMaskedPath.c_str()); - av_dict_free(&opts); return -1; } Debug(1, "Thread count? %d", mVideoCodecContext->thread_count);