[FFmpeg-devel] [PATCH 1/2] avcodec/v4l2_m2m_enc: Fix leak when device init fails

Andriy Gelman andriy.gelman at gmail.com
Tue Mar 10 06:55:40 EET 2020


From: Colin NG <colin_ng at hotmail.com>

Fixes ticket #8285

Signed-off-by: Andriy Gelman <andriy.gelman at gmail.com>
---

This was sent to the mailing list by Colin NG some time ago, but was never
applied.

 libavcodec/v4l2_m2m_enc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
index c9f1741bfd0..ff9ff267ea2 100644
--- a/libavcodec/v4l2_m2m_enc.c
+++ b/libavcodec/v4l2_m2m_enc.c
@@ -316,6 +316,7 @@ static av_cold int v4l2_encode_init(AVCodecContext *avctx)
     ret = ff_v4l2_m2m_codec_init(priv);
     if (ret) {
         av_log(avctx, AV_LOG_ERROR, "can't configure encoder\n");
+        ff_v4l2_m2m_codec_end(priv);
         return ret;
     }
 
-- 
2.25.0



More information about the ffmpeg-devel mailing list