[FFmpeg-cvslog] avformat/matroskadec: free the packet on webvtt side data allocation failure

James Almer git at videolan.org
Tue Feb 20 15:30:32 EET 2018


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue Feb 20 10:25:54 2018 -0300| [88eb368f4210fc2975666f9cb89504b3374094ab] | committer: James Almer

avformat/matroskadec: free the packet on webvtt side data allocation failure

Fixes potential memory leaks

Signed-off-by: James Almer <jamrial at gmail.com>

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

 libavformat/matroskadec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index edc4f5d476..bf0e47ce3a 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3121,6 +3121,7 @@ static int matroska_parse_webvtt(MatroskaDemuxContext *matroska,
                                       AV_PKT_DATA_WEBVTT_IDENTIFIER,
                                       id_len);
         if (!buf) {
+            av_packet_unref(pkt);
             av_free(pkt);
             return AVERROR(ENOMEM);
         }
@@ -3132,6 +3133,7 @@ static int matroska_parse_webvtt(MatroskaDemuxContext *matroska,
                                       AV_PKT_DATA_WEBVTT_SETTINGS,
                                       settings_len);
         if (!buf) {
+            av_packet_unref(pkt);
             av_free(pkt);
             return AVERROR(ENOMEM);
         }



More information about the ffmpeg-cvslog mailing list