diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-08-29 09:04:42 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-08-30 03:00:13 +0200 |
commit | c38405c149df2aee1a3d25942453ca02af5a44b9 (patch) | |
tree | da7959fc8eb0f210e759ea4f8636d33e83bcfa52 | |
parent | 3a76076513c7e817afba7f318b5f0ea20de40e5e (diff) | |
download | ffmpeg-c38405c149df2aee1a3d25942453ca02af5a44b9.tar.gz |
avcodec/roqvideodec: Cleanup generically after init failure
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r-- | libavcodec/roqvideodec.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libavcodec/roqvideodec.c b/libavcodec/roqvideodec.c index a0c293f2f0..dd045ed5eb 100644 --- a/libavcodec/roqvideodec.c +++ b/libavcodec/roqvideodec.c @@ -184,11 +184,8 @@ static av_cold int roq_decode_init(AVCodecContext *avctx) s->last_frame = av_frame_alloc(); s->current_frame = av_frame_alloc(); - if (!s->current_frame || !s->last_frame) { - av_frame_free(&s->current_frame); - av_frame_free(&s->last_frame); + if (!s->current_frame || !s->last_frame) return AVERROR(ENOMEM); - } avctx->pix_fmt = AV_PIX_FMT_YUVJ444P; avctx->color_range = AVCOL_RANGE_JPEG; @@ -248,4 +245,5 @@ AVCodec ff_roq_decoder = { .close = roq_decode_end, .decode = roq_decode_frame, .capabilities = AV_CODEC_CAP_DR1, + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, }; |