diff options
author | Stephan Hilb <stephan@ecshi.net> | 2012-09-01 10:12:33 +0200 |
---|---|---|
committer | Stephan Hilb <stephan@ecshi.net> | 2012-09-01 10:12:33 +0200 |
commit | 296140ebfb7242211852f7736f72dc7f05f0c458 (patch) | |
tree | 382b526eb031b0cd74cc18b6393444e115297178 | |
parent | 54ca7e39dae120fefe96d30e965a304b63a1b491 (diff) | |
download | ffmpeg-296140ebfb7242211852f7736f72dc7f05f0c458.tar.gz |
cpia: move reget_buffer after header check
If the header is invalid, there is no need to get at buffer.
Do it after the header has been checked.
Suggested by Reimar Döffinger
-rw-r--r-- | libavcodec/cpia.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/cpia.c b/libavcodec/cpia.c index c45936b65f..a631a05108 100644 --- a/libavcodec/cpia.c +++ b/libavcodec/cpia.c @@ -61,12 +61,6 @@ static int cpia_decode_frame(AVCodecContext* avctx, AVFrame* const frame = &cpia->frame; uint8_t *y, *u, *v, *y_end, *u_end, *v_end; - // Get buffer filled with previous frame - if ((ret = avctx->reget_buffer(avctx, frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed!\n"); - return ret; - } - // Check header if ( avpkt->size < FRAME_HEADER_SIZE || header[0] != MAGIC_0 || header[1] != MAGIC_1 @@ -104,6 +98,12 @@ static int cpia_decode_frame(AVCodecContext* avctx, frame->key_frame = 0; } + // Get buffer filled with previous frame + if ((ret = avctx->reget_buffer(avctx, frame)) < 0) { + av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed!\n"); + return ret; + } + for ( i = 0; i < frame->height; |