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

Fixes potential memory leaks

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2018-02-20 10:25:54 -03:00
parent acdea9e7c5
commit 88eb368f42

View File

@ -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);
}