aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-01-27 15:32:54 +0000
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-02-03 15:23:21 +0000
commit6f7a32839d1b913be8170e91c3ac9816b314da21 (patch)
tree90be37dc077056ee562b14aaab34643eef893bda /libavcodec
parent67e9f3907d6d438a413df72d72c1339a0c11a290 (diff)
downloadffmpeg-6f7a32839d1b913be8170e91c3ac9816b314da21.tar.gz
svq1enc: correctly handle memory error and allocations
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/svq1enc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
index d70bba3b9d..f49f487f00 100644
--- a/libavcodec/svq1enc.c
+++ b/libavcodec/svq1enc.c
@@ -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);