Commit 6f7a3283 authored by Michael Niedermayer's avatar Michael Niedermayer Committed by Vittorio Giovara

svq1enc: correctly handle memory error and allocations

Signed-off-by: 's avatarVittorio Giovara <vittorio.giovara@gmail.com>
parent 67e9f390
......@@ -583,10 +583,16 @@ static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
ret = ff_get_buffer(avctx, s->current_picture, 0);
if (ret < 0)
return ret;
}
if (!s->last_picture->data[0]) {
ret = ff_get_buffer(avctx, s->last_picture, 0);
if (ret < 0)
return ret;
}
if (!s->scratchbuf) {
s->scratchbuf = av_malloc(s->current_picture->linesize[0] * 16 * 2);
if (!s->scratchbuf)
return AVERROR(ENOMEM);
}
FFSWAP(AVFrame*, s->current_picture, s->last_picture);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment