]> git.sesse.net Git - ffmpeg/commitdiff
avformat/matroskaenc: Fix leak when writing attachment without filename
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Fri, 9 Apr 2021 22:11:06 +0000 (00:11 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Sat, 10 Apr 2021 03:08:28 +0000 (05:08 +0200)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
libavformat/matroskaenc.c

index 609a588f78c9597abf31e5249575b98d8d51fa71..7e108f2db9711bb9ec37863e5d11d1c2995790f8 100644 (file)
@@ -1768,6 +1768,7 @@ static int mkv_write_attachments(AVFormatContext *s)
             put_ebml_string(dyn_cp, MATROSKA_ID_FILEDESC, t->value);
         if (!(t = av_dict_get(st->metadata, "filename", NULL, 0))) {
             av_log(s, AV_LOG_ERROR, "Attachment stream %d has no filename tag.\n", i);
+            ffio_free_dyn_buf(&dyn_cp);
             return AVERROR(EINVAL);
         }
         put_ebml_string(dyn_cp, MATROSKA_ID_FILENAME, t->value);