avformat/matroskaenc: fix leak on error
authorTristan Matthews <tmatth@videolan.org>
Thu, 4 Apr 2019 16:56:26 +0000 (12:56 -0400)
committerJames Almer <jamrial@gmail.com>
Tue, 9 Apr 2019 15:10:36 +0000 (12:10 -0300)
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 1ec777dcdd03b43d3d694c3b4532dccea0b419f0)

libavformat/matroskaenc.c

index aed83ae..ff1cba0 100644 (file)
@@ -694,8 +694,10 @@ static int put_flac_codecpriv(AVFormatContext *s,
         av_dict_set(&dict, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", buf, 0);
 
         len = ff_vorbiscomment_length(dict, vendor);
-        if (len >= ((1<<24) - 4))
+        if (len >= ((1<<24) - 4)) {
+            av_dict_free(&dict);
             return AVERROR(EINVAL);
+        }
 
         data = av_malloc(len + 4);
         if (!data) {