diff mbox series

[FFmpeg-devel,1/4] avformat/mov: Free encryption data on error

Message ID 20200127082821.22770-1-andreas.rheinhardt@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,1/4] avformat/mov: Free encryption data on error | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Andreas Rheinhardt Jan. 27, 2020, 8:28 a.m. UTC
Fixes memleak and Coverity issue #1439587.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/mov.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer Jan. 28, 2020, 3:35 p.m. UTC | #1
On Mon, Jan 27, 2020 at 09:28:18AM +0100, Andreas Rheinhardt wrote:
> Fixes memleak and Coverity issue #1439587.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/mov.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 589576b529..7b7d4f43fa 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);