[FFmpeg-cvslog] avformat/mov: Free encryption data on error

Andreas Rheinhardt git at videolan.org
Tue Jan 28 18:20:21 EET 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Mon Jan 27 09:28:18 2020 +0100| [3999c4b374c2f3786137bd7e820dd1555fc20d90] | committer: Michael Niedermayer

avformat/mov: Free encryption data on error

Fixes memleak and Coverity issue #1439587.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/mov.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 064fa88137..b9e32874c4 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6329,8 +6329,10 @@ static int mov_read_pssh(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     if (version > 0) {
         kid_count = avio_rb32(pb);
-        if (kid_count >= INT_MAX / sizeof(*key_ids))
-            return AVERROR(ENOMEM);
+        if (kid_count >= INT_MAX / sizeof(*key_ids)) {
+            ret = AVERROR(ENOMEM);
+            goto finish;
+        }
 
         for (unsigned int i = 0; i < kid_count && !pb->eof_reached; i++) {
             unsigned int min_kid_count = FFMIN(FFMAX(i + 1, 1024), kid_count);



More information about the ffmpeg-cvslog mailing list