]> git.sesse.net Git - ffmpeg/commitdiff
avformat/movenc: Don't forget to free fragment buffers
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 28 Sep 2020 16:36:06 +0000 (18:36 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 4 Oct 2020 22:49:31 +0000 (00:49 +0200)
The buffers used when fragmented output is enabled have up until now not
been freed in the deinit function; they leak e.g. if one errors out of
mov_write_trailer() before one reaches the point where they are normally
written out and freed. This can e.g. happen if allocating new vos_data
fails at the beginning of mov_write_trailer().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/movenc.c

index 6ed93d89eaed888ee5de579453059ce4bc6ad910..5454a9172c61c3bd36e3cd80d97a6eac72c59bbf 100644 (file)
@@ -6284,9 +6284,11 @@ static void mov_free(AVFormatContext *s)
             av_freep(&mov->tracks[i].vos_data);
 
         ff_mov_cenc_free(&mov->tracks[i].cenc);
+        ffio_free_dyn_buf(&mov->tracks[i].mdat_buf);
     }
 
     av_freep(&mov->tracks);
+    ffio_free_dyn_buf(&mov->mdat_buf);
 }
 
 static uint32_t rgb_to_yuv(uint32_t rgb)