]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mov: Free encryption data on error
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 27 Jan 2020 08:28:18 +0000 (09:28 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 28 Jan 2020 16:18:27 +0000 (17:18 +0100)
Fixes memleak and Coverity issue #1439587.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mov.c

index 064fa88137dd165dbf28931a1b849fd76e48749e..b9e32874c4dd3a571060e42f1fc466d4c5168a79 100644 (file)
@@ -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);