Quoting Diego Biurrun (2015-04-07 17:55:19)
> On Sun, Apr 05, 2015 at 09:04:09AM +0200, Anton Khirnov wrote:
> > Quoting Diego Biurrun (2015-03-31 16:31:33)
> > > +unsigned ff_els_decode_unsigned(ElsDecCtx *ctx, ElsUnsignedRung *ur)
> > > +{
> > > +    int i, n, r, bit;
> > > +    ElsRungNode *rung_node;
> > > +
> > > +    if (ctx->err)
> > > +        return 0;
> > > +
> > > +    /* decode unary prefix */
> > > +    for (n = 0; n < ELS_EXPGOLOMB_LEN + 1; n++)
> > > +        if (ff_els_decode_bit(ctx, &ur->prefix_rung[n]))
> > > +            break;
> > > +
> > > +    /* handle the error/overflow case */
> > > +    if (ctx->err || n >= ELS_EXPGOLOMB_LEN) {
> > > +        ctx->err = AVERROR(EOVERFLOW);
> > > +        return 0;
> > > +    }
> > > +
> > > +    /* handle the zero case */
> > > +    if (!n)
> > > +        return 0;
> > > +
> > > +    /* initialize probability tree */
> > > +    if (!ur->rem_rung_list) {
> > > +        ur->rem_rung_list = av_mallocz(RUNG_SPACE);
> > 
> > This variable mixes malloc and realloc, that should not be done.
> 
> I switched it to get allocated by plain calloc().

eh...calloc?

> 
> > Also, it gets freed in quite unrelated code. I think it'd be cleaner to
> > have an uninit function.
> 
> What would you put in that uninit function?  Just the call to free()?

Yes.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to