]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mov: Don't leak MOVFragmentStreamInfo on error
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 27 Jan 2020 08:28:19 +0000 (09:28 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 28 Jan 2020 16:18:27 +0000 (17:18 +0100)
Fixes Coverity issue #1441933.

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

index b9e32874c4dd3a571060e42f1fc466d4c5168a79..3a183ed0153e76c09fc43b1f472fe7ae9cce1ea7 100644 (file)
@@ -1327,8 +1327,10 @@ static int update_frag_index(MOVContext *c, int64_t offset)
 
     for (i = 0; i < c->fc->nb_streams; i++) {
         // Avoid building frag index if streams lack track id.
-        if (c->fc->streams[i]->id < 0)
+        if (c->fc->streams[i]->id < 0) {
+            av_free(frag_stream_info);
             return AVERROR_INVALIDDATA;
+        }
 
         frag_stream_info[i].id = c->fc->streams[i]->id;
         frag_stream_info[i].sidx_pts = AV_NOPTS_VALUE;