From afd5f3227ec38fea70bf7abfcd107a9493aa21fc Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 1 Dec 2017 07:22:06 +0100 Subject: [PATCH] video: fix memory leaks with hwdec copy modes This leaked 2 unreffed AVFrame structs (roughly 1KB) per decoded frame. Can I blame the FFmpeg API and the weird difference between freeing and unreffing an AVFrame? --- video/mp_image_pool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/video/mp_image_pool.c b/video/mp_image_pool.c index ff743b4da7..809b4f3352 100644 --- a/video/mp_image_pool.c +++ b/video/mp_image_pool.c @@ -297,9 +297,9 @@ struct mp_image *mp_image_hw_download(struct mp_image *src, } int res = av_hwframe_transfer_data(dstav, srcav, 0); - av_frame_unref(srcav); + av_frame_free(&srcav); dst = mp_image_from_av_frame(dstav); - av_frame_unref(dstav); + av_frame_free(&dstav); if (res >= 0 && dst) { mp_image_set_size(dst, src->w, src->h); mp_image_copy_attributes(dst, src);