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 b9e3287..3a183ed 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;