[FFmpeg-cvslog] avformat/aadec: Fix leak on error

Andreas Rheinhardt git at videolan.org
Sat Apr 3 01:18:08 EEST 2021


ffmpeg | branch: release/4.4 | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Wed Mar 24 03:23:37 2021 +0100| [a01cf1fe5410f7db7a473821369506e27cf60044] | committer: Andreas Rheinhardt

avformat/aadec: Fix leak on error

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
(cherry picked from commit 3ec3370deac4d21538ef03d8547a12f3acb7bfa8)

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

 libavformat/aadec.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/aadec.c b/libavformat/aadec.c
index 80ca2c12d7..2575e98153 100644
--- a/libavformat/aadec.c
+++ b/libavformat/aadec.c
@@ -229,8 +229,11 @@ static int aa_read_header(AVFormatContext *s)
         chapter_pos -= start + CHAPTER_HEADER_SIZE * chapter_idx;
         avio_skip(pb, 4 + chapter_size);
         if (!avpriv_new_chapter(s, chapter_idx, st->time_base,
-            chapter_pos * TIMEPREC, (chapter_pos + chapter_size) * TIMEPREC, NULL))
-                return AVERROR(ENOMEM);
+                                chapter_pos * TIMEPREC,
+                                (chapter_pos + chapter_size) * TIMEPREC, NULL)) {
+            av_freep(&c->tea_ctx);
+            return AVERROR(ENOMEM);
+        }
     }
 
     st->duration = (largest_size - CHAPTER_HEADER_SIZE * s->nb_chapters) * TIMEPREC;



More information about the ffmpeg-cvslog mailing list