diff options
author | Limin Wang <lance.lmwang@gmail.com> | 2020-04-30 13:29:48 +0300 |
---|---|---|
committer | Limin Wang <lance.lmwang@gmail.com> | 2020-05-05 03:20:45 +0300 |
commit | 79e3c4dd7485e469b2d0e29e2775d4e37b55bfa7 (patch) | |
tree | 4ed15bc4707b3c53da2e306cdf4d92f31cae5d99 /libavcodec/utils.c | |
parent | ab7bcfb80c698a378aaab8fc7fd9408853034b78 (diff) |
avcodec/utils: simplify, remove duplicate code
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index e77090daef..91b271a717 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -584,37 +584,14 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code avctx->internal = avci; avci->to_free = av_frame_alloc(); - if (!avci->to_free) { - ret = AVERROR(ENOMEM); - goto free_and_end; - } - avci->compat_decode_frame = av_frame_alloc(); - if (!avci->compat_decode_frame) { - ret = AVERROR(ENOMEM); - goto free_and_end; - } - avci->buffer_frame = av_frame_alloc(); - if (!avci->buffer_frame) { - ret = AVERROR(ENOMEM); - goto free_and_end; - } - avci->buffer_pkt = av_packet_alloc(); - if (!avci->buffer_pkt) { - ret = AVERROR(ENOMEM); - goto free_and_end; - } - avci->ds.in_pkt = av_packet_alloc(); - if (!avci->ds.in_pkt) { - ret = AVERROR(ENOMEM); - goto free_and_end; - } - avci->last_pkt_props = av_packet_alloc(); - if (!avci->last_pkt_props) { + if (!avci->to_free || !avci->compat_decode_frame || + !avci->buffer_frame || !avci->buffer_pkt || + !avci->ds.in_pkt || !avci->last_pkt_props) { ret = AVERROR(ENOMEM); goto free_and_end; } |