[FFmpeg-devel] [PATCH 2/5] decode: avoid leaks on failure in ff_get_buffer()

wm4 nfxjfg at googlemail.com
Fri Oct 13 19:59:16 EEST 2017


From: Anton Khirnov <anton at khirnov.net>

If the get_buffer() call fails, the frame might have some side data
already set. Make sure it gets freed.

CC: libav-stable at libav.org

Merges Libav commit de77671438c24ffea93398c8dc885d4dd04477de.
---
 libavcodec/decode.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 1337ffb527..437b848248 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1658,6 +1658,9 @@ end:
         frame->height = avctx->height;
     }
 
+    if (ret < 0)
+        av_frame_unref(frame);
+
     return ret;
 }
 
-- 
2.14.1



More information about the ffmpeg-devel mailing list