Commit e43e97f0 authored by Matt Wolenetz's avatar Matt Wolenetz Committed by Michael Niedermayer

lavc/libopusdec: Allow avcodec_open2 to call .close

If there is a decoder initialization failure detected in avcodec_open2
after .init is called, allow graceful decoder .close to prevent leaking
libopus decoder allocations.

BUG=828526
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent aea610b0
......@@ -160,7 +160,10 @@ static av_cold int libopus_decode_close(AVCodecContext *avc)
{
struct libopus_context *opus = avc->priv_data;
if (opus->dec) {
opus_multistream_decoder_destroy(opus->dec);
opus->dec = NULL;
}
return 0;
}
......@@ -252,6 +255,7 @@ AVCodec ff_libopus_decoder = {
.decode = libopus_decode,
.flush = libopus_flush,
.capabilities = AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT,
AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_NONE },
......
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