[FFmpeg-cvslog] decode: avoid leaks on failure in ff_get_buffer()

Anton Khirnov git at videolan.org
Sat Nov 11 00:45:56 EET 2017


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Jul  1 11:32:56 2017 +0200| [de77671438c24ffea93398c8dc885d4dd04477de] | committer: Anton Khirnov

decode: avoid leaks on failure in ff_get_buffer()

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

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=de77671438c24ffea93398c8dc885d4dd04477de
---

 libavcodec/decode.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 9644e89f48..f7cd7f6870 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1069,6 +1069,9 @@ end:
         frame->height = avctx->height;
     }
 
+    if (ret < 0)
+        av_frame_unref(frame);
+
     return ret;
 }
 



More information about the ffmpeg-cvslog mailing list