summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorLimin Wang <lance.lmwang@gmail.com>2020-06-03 21:53:11 +0800
committerLimin Wang <lance.lmwang@gmail.com>2020-06-13 06:59:18 +0800
commit4b2863ff01b1fe93d9a518523c9098d17a9d8c6f (patch)
tree3d22950a39759f7cdc564480a5e4f292cafd3aaf /libavcodec/mpegvideo.c
parent42a38503600531ee34efbe07c6dffb41a11a5a1d (diff)
avcodec: add FF_CODEC_CAP_INIT_CLEANUP for all codecs which use ff_mpv_common_init()
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 49fd1c999d..eb73198b75 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -991,7 +991,6 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
fail_nomem:
ret = AVERROR(ENOMEM);
fail:
- ff_mpv_common_end(s);
return ret;
}
@@ -1123,7 +1122,6 @@ int ff_mpv_common_frame_size_change(MpegEncContext *s)
return 0;
fail:
- ff_mpv_common_end(s);
return err;
}
@@ -1151,6 +1149,9 @@ void ff_mpv_common_end(MpegEncContext *s)
av_freep(&s->bitstream_buffer);
s->allocated_bitstream_buffer_size = 0;
+ if (!s->avctx)
+ return;
+
if (s->picture) {
for (i = 0; i < MAX_PICTURE_COUNT; i++) {
ff_free_picture_tables(&s->picture[i]);