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

Anton Khirnov git at videolan.org
Mon Oct 30 02:29:32 EET 2017


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Fri Oct 13 18:59:16 2017 +0200| [4776c61424fa32394e251e9769e1ad2c2fa55598] | committer: James Almer

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.

Merges Libav commit de77671438c24ffea93398c8dc885d4dd04477de.

Signed-off-by: James Almer <jamrial at gmail.com>

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

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

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 15fc82ad39..86fe5aef52 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1598,6 +1598,9 @@ end:
         frame->height = avctx->height;
     }
 
+    if (ret < 0)
+        av_frame_unref(frame);
+
     return ret;
 }
 



More information about the ffmpeg-cvslog mailing list