[FFmpeg-cvslog] avformat/matroskaenc: Use ffio_free_dyn_buf

Andreas Rheinhardt git at videolan.org
Tue Oct 22 02:36:46 EEST 2019


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Wed Oct 16 03:57:09 2019 +0200| [7797fdfe6f33a7fc35ec147edcb7d1aac47b4a75] | committer: James Almer

avformat/matroskaenc: Use ffio_free_dyn_buf

instead of replicating its behaviour.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7797fdfe6f33a7fc35ec147edcb7d1aac47b4a75
---

 libavformat/matroskaenc.c | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 3f9bd3445d..b924a64b03 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -391,23 +391,12 @@ static void put_xiph_size(AVIOContext *pb, int size)
 static void mkv_deinit(AVFormatContext *s)
 {
     MatroskaMuxContext *mkv = s->priv_data;
-    uint8_t* buf;
-    if (mkv->cluster_bc) {
-        avio_close_dyn_buf(mkv->cluster_bc, &buf);
-        av_free(buf);
-    }
-    if (mkv->info_bc) {
-        avio_close_dyn_buf(mkv->info_bc, &buf);
-        av_free(buf);
-    }
-    if (mkv->tracks_bc) {
-        avio_close_dyn_buf(mkv->tracks_bc, &buf);
-        av_free(buf);
-    }
-    if (mkv->tags_bc) {
-        avio_close_dyn_buf(mkv->tags_bc, &buf);
-        av_free(buf);
-    }
+
+    ffio_free_dyn_buf(&mkv->cluster_bc);
+    ffio_free_dyn_buf(&mkv->info_bc);
+    ffio_free_dyn_buf(&mkv->tracks_bc);
+    ffio_free_dyn_buf(&mkv->tags_bc);
+
     if (mkv->seekhead) {
         av_freep(&mkv->seekhead->entries);
         av_freep(&mkv->seekhead);



More information about the ffmpeg-cvslog mailing list