aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-06-01 02:37:30 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-06-01 02:38:06 +0200
commitf24b7d7616533cd00475d7bf93f3a33ff5ac40dc (patch)
tree046a75597c1ddbc7caa5b1cd9e4c93d881d8aca7
parentabee1972ef8a88fde0bff5f40f4767cb3150d26e (diff)
parent28fb80dcbf6f63eedfcfffc725a6bf0069d03fab (diff)
downloadffmpeg-f24b7d7616533cd00475d7bf93f3a33ff5ac40dc.tar.gz
Merge commit '28fb80dcbf6f63eedfcfffc725a6bf0069d03fab'
* commit '28fb80dcbf6f63eedfcfffc725a6bf0069d03fab': svq1: Check memory allocation Conflicts: libavcodec/svq1enc.c See: 2a3af77284412b56eb0085f4b97d9db5aa04a64f Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/svq1enc.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
index 3fc7ecaa52..56031451de 100644
--- a/libavcodec/svq1enc.c
+++ b/libavcodec/svq1enc.c
@@ -556,8 +556,8 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx)
s->y_block_height * sizeof(int32_t));
s->ssd_int8_vs_int16 = ssd_int8_vs_int16_c;
- if (!s->m.me.scratchpad || !s->m.me.map || !s->m.me.score_map ||
- !s->mb_type || !s->dummy) {
+ if (!s->m.me.temp || !s->m.me.scratchpad || !s->m.me.map ||
+ !s->m.me.score_map || !s->mb_type || !s->dummy) {
svq1_encode_end(avctx);
return AVERROR(ENOMEM);
}
@@ -622,8 +622,15 @@ static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
s->frame_width / (i ? 4 : 1),
s->frame_height / (i ? 4 : 1),
pict->linesize[i],
- s->current_picture->linesize[i]) < 0)
+ s->current_picture->linesize[i]) < 0) {
+ int j;
+ for (j = 0; j < i; j++) {
+ av_freep(&s->motion_val8[j]);
+ av_freep(&s->motion_val16[j]);
+ }
+ av_freep(&s->scratchbuf);
return -1;
+ }
// avpriv_align_put_bits(&s->pb);
while (put_bits_count(&s->pb) & 31)