On 12/02/18 00:31, James Almer wrote:
> On 2/11/2018 3:14 PM, Mark Thompson wrote:
>> +int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx,
>> +                              CodedBitstreamUnit *unit,
>> +                              size_t size,
>> +                              void (*free)(void *opaque, uint8_t *data))
>> +{
>> +    av_assert0(!unit->content && !unit->content_ref);
>> +
>> +    unit->content = av_mallocz(size);
>> +    if (!unit->content)
>> +        return AVERROR(ENOMEM);
>> +
>> +    unit->content_ref = av_buffer_create(unit->content, size,
>> +                                         free ? free
>> +                                              : &av_buffer_default_free,
> 
> av_buffer_create() defaults to av_buffer_default_free() on its own if
> free is NULL, so no need to do it here.

Aha, so it does!  Fixed in all three places I used it explicitly.

Thanks,

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

Reply via email to