Browse Source

avcodec/utils: Move avctx->codec check before its use

Fixes CID1361954

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n3.1
Michael Niedermayer 9 years ago
parent
commit
b24fffeb94
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      libavcodec/utils.c

+ 3
- 2
libavcodec/utils.c View File

@@ -2281,6 +2281,9 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,

*got_frame_ptr = 0;

if (!avctx->codec)
return AVERROR(EINVAL);

if (!avctx->codec->decode) {
av_log(avctx, AV_LOG_ERROR, "This decoder requires using the avcodec_send_packet() API.\n");
return AVERROR(ENOSYS);
@@ -2290,8 +2293,6 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
av_log(avctx, AV_LOG_ERROR, "invalid packet: NULL data, size != 0\n");
return AVERROR(EINVAL);
}
if (!avctx->codec)
return AVERROR(EINVAL);
if (avctx->codec->type != AVMEDIA_TYPE_AUDIO) {
av_log(avctx, AV_LOG_ERROR, "Invalid media type for audio\n");
return AVERROR(EINVAL);


Loading…
Cancel
Save