mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-04 06:08:26 +02:00
avcodec/xan: Cleanup generically on init failure
Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
13f10dc15e
commit
85e1d469af
@ -100,16 +100,12 @@ static av_cold int xan_decode_init(AVCodecContext *avctx)
|
||||
return AVERROR(ENOMEM);
|
||||
s->buffer2_size = avctx->width * avctx->height;
|
||||
s->buffer2 = av_malloc(s->buffer2_size + 130);
|
||||
if (!s->buffer2) {
|
||||
av_freep(&s->buffer1);
|
||||
if (!s->buffer2)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
s->last_frame = av_frame_alloc();
|
||||
if (!s->last_frame) {
|
||||
xan_decode_end(avctx);
|
||||
if (!s->last_frame)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -649,4 +645,5 @@ AVCodec ff_xan_wc3_decoder = {
|
||||
.close = xan_decode_end,
|
||||
.decode = xan_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user