diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-11-27 18:28:24 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-11-29 00:38:32 +0100 |
commit | 7eb9cf593e33dfdb1127d325d25a93c4c52b59d7 (patch) | |
tree | ce8a3e220de99228d8c9e59f05f561edaa58d589 /libavcodec/pafvideo.c | |
parent | 9227721ef0174421cb37bc9d0db6851b460b83b4 (diff) | |
download | ffmpeg-7eb9cf593e33dfdb1127d325d25a93c4c52b59d7.tar.gz |
avcodec/pafvideo: Cleanup generically on init failure
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/pafvideo.c')
-rw-r--r-- | libavcodec/pafvideo.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libavcodec/pafvideo.c b/libavcodec/pafvideo.c index 22ae26ac10..1e5d891332 100644 --- a/libavcodec/pafvideo.c +++ b/libavcodec/pafvideo.c @@ -104,10 +104,8 @@ static av_cold int paf_video_init(AVCodecContext *avctx) c->video_size = avctx->width * avctx->height; for (i = 0; i < 4; i++) { c->frame[i] = av_mallocz(c->frame_size); - if (!c->frame[i]) { - paf_video_close(avctx); + if (!c->frame[i]) return AVERROR(ENOMEM); - } } return 0; @@ -419,5 +417,5 @@ AVCodec ff_paf_video_decoder = { .close = paf_video_close, .decode = paf_video_decode, .capabilities = AV_CODEC_CAP_DR1, - .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, }; |