Commit 6dc7dd7a authored by Justin Ruggles's avatar Justin Ruggles

atrac1: check for ff_mdct_init() failure

parent 21dcecc3
...@@ -326,9 +326,24 @@ static int atrac1_decode_frame(AVCodecContext *avctx, void *data, ...@@ -326,9 +326,24 @@ static int atrac1_decode_frame(AVCodecContext *avctx, void *data,
} }
static av_cold int atrac1_decode_end(AVCodecContext * avctx)
{
AT1Ctx *q = avctx->priv_data;
av_freep(&q->out_samples[0]);
ff_mdct_end(&q->mdct_ctx[0]);
ff_mdct_end(&q->mdct_ctx[1]);
ff_mdct_end(&q->mdct_ctx[2]);
return 0;
}
static av_cold int atrac1_decode_init(AVCodecContext *avctx) static av_cold int atrac1_decode_init(AVCodecContext *avctx)
{ {
AT1Ctx *q = avctx->priv_data; AT1Ctx *q = avctx->priv_data;
int ret;
avctx->sample_fmt = AV_SAMPLE_FMT_FLT; avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
...@@ -349,9 +364,13 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx) ...@@ -349,9 +364,13 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
} }
/* Init the mdct transforms */ /* Init the mdct transforms */
ff_mdct_init(&q->mdct_ctx[0], 6, 1, -1.0/ (1 << 15)); if ((ret = ff_mdct_init(&q->mdct_ctx[0], 6, 1, -1.0/ (1 << 15))) ||
ff_mdct_init(&q->mdct_ctx[1], 8, 1, -1.0/ (1 << 15)); (ret = ff_mdct_init(&q->mdct_ctx[1], 8, 1, -1.0/ (1 << 15))) ||
ff_mdct_init(&q->mdct_ctx[2], 9, 1, -1.0/ (1 << 15)); (ret = ff_mdct_init(&q->mdct_ctx[2], 9, 1, -1.0/ (1 << 15)))) {
av_log(avctx, AV_LOG_ERROR, "Error initializing MDCT\n");
atrac1_decode_end(avctx);
return ret;
}
ff_init_ff_sine_windows(5); ff_init_ff_sine_windows(5);
...@@ -374,18 +393,6 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx) ...@@ -374,18 +393,6 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
} }
static av_cold int atrac1_decode_end(AVCodecContext * avctx) {
AT1Ctx *q = avctx->priv_data;
av_freep(&q->out_samples[0]);
ff_mdct_end(&q->mdct_ctx[0]);
ff_mdct_end(&q->mdct_ctx[1]);
ff_mdct_end(&q->mdct_ctx[2]);
return 0;
}
AVCodec ff_atrac1_decoder = { AVCodec ff_atrac1_decoder = {
.name = "atrac1", .name = "atrac1",
.type = AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment