summaryrefslogtreecommitdiff
path: root/libavformat/oggparseflac.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-05-28 00:40:46 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-05-28 01:22:01 +0200
commitf66ca036bca1678786322c35bc4853ecd0a7d9eb (patch)
tree8716f57cd9ee3b057840bfcc741c80b7e0870fde /libavformat/oggparseflac.c
parent9106cba22ad84f133296245e974a0c3a4c45e497 (diff)
downloadffmpeg-f66ca036bca1678786322c35bc4853ecd0a7d9eb.tar.gz
avformat/oggparseflac: Fix memleaks in old_flac_header()
Fixes CID1361953 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/oggparseflac.c')
-rw-r--r--libavformat/oggparseflac.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c
index f08d07d7ab..b5f1416a3c 100644
--- a/libavformat/oggparseflac.c
+++ b/libavformat/oggparseflac.c
@@ -95,12 +95,14 @@ old_flac_header (AVFormatContext * s, int idx)
st->codecpar->codec_id = AV_CODEC_ID_FLAC;
avctx = avcodec_alloc_context3(NULL);
- if (!avctx)
- return -1;
+ if (!avctx) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
ret = avcodec_parameters_to_context(avctx, st->codecpar);
if (ret < 0)
- return -1;
+ goto fail;
parser->flags = PARSER_FLAG_COMPLETE_FRAMES;
av_parser_parse2(parser, avctx,
@@ -117,6 +119,10 @@ old_flac_header (AVFormatContext * s, int idx)
avcodec_free_context(&avctx);
return 1;
+fail:
+ av_parser_close(parser);
+ avcodec_free_context(&avctx);
+ return ret;
}
const struct ogg_codec ff_flac_codec = {