diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index ec52b50214..81691e97db 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2264,7 +2264,8 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska, /* XXX: prevent data copy... */ if (av_new_packet(pkt, pkt_size + offset) < 0) { av_free(pkt); - return AVERROR(ENOMEM); + res = AVERROR(ENOMEM); + goto fail; } if (st->codec->codec_id == AV_CODEC_ID_PRORES) {