On Tue, Feb 23, 2016 at 10:23:37AM -0500, Vittorio Giovara wrote:
> On Tue, Feb 23, 2016 at 6:09 AM, Diego Biurrun <di...@biurrun.de> wrote:
> > On Mon, Feb 22, 2016 at 08:17:31PM -0500, Vittorio Giovara wrote:
> >> --- a/libavcodec/vc1dec.c
> >> +++ b/libavcodec/vc1dec.c
> >> @@ -360,7 +360,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context 
> >> *v)
> >>
> >> -    ff_intrax8_common_init(&v->x8,s);
> >> +    ret = ff_intrax8_common_init(&v->x8, s);
> >>
> >>      if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id 
> >> == AV_CODEC_ID_VC1IMAGE) {
> >>          for (i = 0; i < 4; i++)
> >> @@ -369,7 +369,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context 
> >> *v)
> >>
> >>      if (!v->mv_type_mb_plane || !v->direct_mb_plane || !v->acpred_plane 
> >> || !v->over_flags_plane ||
> >>          !v->block || !v->cbp_base || !v->ttblk_base || !v->is_intra_base 
> >> || !v->luma_mv_base ||
> >> -        !v->mb_type_base) {
> >> +        !v->mb_type_base || ret < 0) {
> >>          av_freep(&v->mv_type_mb_plane);
> >>          av_freep(&v->direct_mb_plane);
> >
> > You should return right away, not pointlessly call those mallocs after
> > the failure.
> 
> If I return right away I leak all the mallocs above.

So move the init call to the start of the function.

Diego
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to