Quoting Mark Thompson (2017-05-26 00:46:09)
> On 20/05/17 07:35, Anton Khirnov wrote:
> > Quoting Mark Thompson (2017-05-14 23:24:10)
> >> +int ff_cbs_insert_unit(CodedBitstreamContext *ctx,
> >> +                       CodedBitstreamFragment *frag,
> >> +                       int position, int type, void *content)
> >> +{
> >> +    int err;
> >> +
> >> +    if (position == -1)
> >> +        position = frag->nb_units;
> >> +    if (position < 0 || position > frag->nb_units)
> >> +        return AVERROR(EINVAL);
> >> +
> >> +    err = av_reallocp_array(&frag->units,
> >> +                            frag->nb_units + 1,
> >> +                            sizeof(*frag->units));
> > 
> > If I'm reading right, units themselves need to be uninited, so reallocp
> > is not what you want here.
> 
> Not sure what you're getting at here?  There aren't any pointers to the unit 
> structure, so if it gets moved when adding one this is fine.

reallocp frees the array on failure, which leaks the contents of units.

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

Reply via email to