[FFmpeg-cvslog] avformat/av1: Fix leak of dynamic buffer in case of parsing failure

Andreas Rheinhardt git at videolan.org
Thu Jul 2 03:32:46 EEST 2020


ffmpeg | branch: release/4.1 | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Thu Nov 21 07:17:19 2019 +0100| [26ceb54a28d5d3c411e5eab6ba7a18571d3e076c] | committer: Andreas Rheinhardt

avformat/av1: Fix leak of dynamic buffer in case of parsing failure

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>
(cherry picked from commit 27c6c925344e00c1a72ba8bb2b5cdd32cb1a2655)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

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

 libavformat/av1.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/av1.c b/libavformat/av1.c
index 5fde8df97e..8d80682b24 100644
--- a/libavformat/av1.c
+++ b/libavformat/av1.c
@@ -26,6 +26,7 @@
 #include "libavcodec/put_bits.h"
 #include "av1.h"
 #include "avio.h"
+#include "avio_internal.h"
 
 int ff_av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size)
 {
@@ -67,8 +68,10 @@ int ff_av1_filter_obus_buf(const uint8_t *buf, uint8_t **out, int *size)
         return ret;
 
     ret = ff_av1_filter_obus(pb, buf, *size);
-    if (ret < 0)
+    if (ret < 0) {
+        ffio_free_dyn_buf(&pb);
         return ret;
+    }
 
     av_freep(out);
     *size = avio_close_dyn_buf(pb, out);



More information about the ffmpeg-cvslog mailing list