On 12/05/15 19:34, Diego Biurrun wrote: > From: Vittorio Giovara <[email protected]> > > Signed-off-by: Diego Biurrun <[email protected]> > --- > > Frees memory on svq1_encode_plane() failure, still needs testing. > > libavcodec/svq1enc.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c > index f49f487..4f2d6e5 100644 > --- a/libavcodec/svq1enc.c > +++ b/libavcodec/svq1enc.c > @@ -293,6 +293,11 @@ static int svq1_encode_plane(SVQ1EncContext *s, int > plane, > s->motion_val16[plane] = av_mallocz((s->m.mb_stride * > (block_height + 2) + 1) * > 2 * sizeof(int16_t)); > + if (!s->motion_val8[plane] || !s->motion_val16[plane]) { > + av_freep(s->motion_val8[plane]); > + av_freep(s->motion_val16[plane]); > + return AVERROR(ENOMEM); > + } > } > > s->m.mb_type = s->mb_type; > @@ -550,6 +555,12 @@ 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.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); > + } > + > if (ARCH_PPC) > ff_svq1enc_init_ppc(s); > if (ARCH_X86) >
Should work fine. _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
