diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-11-26 18:11:29 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-12-04 15:46:46 +0100 |
commit | e645f0f0d3049f13f2a95b491226702054a7038e (patch) | |
tree | e40c7bd6035bf42bbed09de9843c2152b90b7283 | |
parent | 703abb3c0e762a174bac9668fa4502932b29d43f (diff) | |
download | ffmpeg-e645f0f0d3049f13f2a95b491226702054a7038e.tar.gz |
avcodec/xxan: Cleanup generically on init failure
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r-- | libavcodec/xxan.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/libavcodec/xxan.c b/libavcodec/xxan.c index afe60e1564..865dfa8f87 100644 --- a/libavcodec/xxan.c +++ b/libavcodec/xxan.c @@ -71,16 +71,12 @@ static av_cold int xan_decode_init(AVCodecContext *avctx) if (!s->y_buffer) return AVERROR(ENOMEM); s->scratch_buffer = av_malloc(s->buffer_size + 130); - if (!s->scratch_buffer) { - xan_decode_end(avctx); + if (!s->scratch_buffer) return AVERROR(ENOMEM); - } s->pic = av_frame_alloc(); - if (!s->pic) { - xan_decode_end(avctx); + if (!s->pic) return AVERROR(ENOMEM); - } return 0; } @@ -447,4 +443,5 @@ AVCodec ff_xan_wc4_decoder = { .close = xan_decode_end, .decode = xan_decode_frame, .capabilities = AV_CODEC_CAP_DR1, + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, }; |