Commit 7d3baebe authored by Andreas Cadhalpun's avatar Andreas Cadhalpun

opus_parser: fix leaking channel_maps on error

Make ff_opus_parse_extradata free allocated memory on error instead of
expecting callers to free it in that case.
Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: 's avatarAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
parent df694a5e
...@@ -403,6 +403,7 @@ av_cold int ff_opus_parse_extradata(AVCodecContext *avctx, ...@@ -403,6 +403,7 @@ av_cold int ff_opus_parse_extradata(AVCodecContext *avctx,
} else if (idx >= streams + stereo_streams) { } else if (idx >= streams + stereo_streams) {
av_log(avctx, AV_LOG_ERROR, av_log(avctx, AV_LOG_ERROR,
"Invalid channel map for output channel %d: %d\n", i, idx); "Invalid channel map for output channel %d: %d\n", i, idx);
av_freep(&s->channel_maps);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
......
...@@ -646,7 +646,6 @@ static av_cold int opus_decode_init(AVCodecContext *avctx) ...@@ -646,7 +646,6 @@ static av_cold int opus_decode_init(AVCodecContext *avctx)
/* find out the channel configuration */ /* find out the channel configuration */
ret = ff_opus_parse_extradata(avctx, c); ret = ff_opus_parse_extradata(avctx, c);
if (ret < 0) { if (ret < 0) {
av_freep(&c->channel_maps);
av_freep(&c->fdsp); av_freep(&c->fdsp);
return ret; return ret;
} }
......
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