1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-15 14:13:16 +02:00

avformat/oggparseflac: Fix memleaks in old_flac_header()

Fixes CID1361953

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2016-05-28 00:40:46 +02:00
parent 9106cba22a
commit f66ca036bc

View File

@@ -95,12 +95,14 @@ old_flac_header (AVFormatContext * s, int idx)
st->codecpar->codec_id = AV_CODEC_ID_FLAC; st->codecpar->codec_id = AV_CODEC_ID_FLAC;
avctx = avcodec_alloc_context3(NULL); avctx = avcodec_alloc_context3(NULL);
if (!avctx) if (!avctx) {
return -1; ret = AVERROR(ENOMEM);
goto fail;
}
ret = avcodec_parameters_to_context(avctx, st->codecpar); ret = avcodec_parameters_to_context(avctx, st->codecpar);
if (ret < 0) if (ret < 0)
return -1; goto fail;
parser->flags = PARSER_FLAG_COMPLETE_FRAMES; parser->flags = PARSER_FLAG_COMPLETE_FRAMES;
av_parser_parse2(parser, avctx, av_parser_parse2(parser, avctx,
@@ -117,6 +119,10 @@ old_flac_header (AVFormatContext * s, int idx)
avcodec_free_context(&avctx); avcodec_free_context(&avctx);
return 1; return 1;
fail:
av_parser_close(parser);
avcodec_free_context(&avctx);
return ret;
} }
const struct ogg_codec ff_flac_codec = { const struct ogg_codec ff_flac_codec = {