mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-18 21:45:10 +00:00
svq1enc: correctly handle memory error and allocations
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
This commit is contained in:
parent
67e9f3907d
commit
6f7a32839d
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user