[FFmpeg-devel] [PATCH v9 3/5] avcodec/libjxl: add Jpeg XL encoding via libjxl

Leo Izen leo.izen at gmail.com
Tue Mar 29 00:16:09 EEST 2022


On 3/23/22 11:08, Andreas Rheinhardt wrote:
>> +            temp = av_realloc(ctx->buffer, ctx->buffer_size);
>> +            if (!temp) {
>> +                av_freep(&ctx->buffer);
> If you free this, you will be in a scenario where ctx->buffer is NULL,
> yet ctx->buffer_size is > 0. This is inconsistent and might lead to
> crashs in JxlEncoderProcessOutput. So don't free this and only set
> buffer_size after the reallocation succeeded.
Does it matter what ctx->buffer_size is if ctx->buffer is NULL?
On 3/23/22 11:08, Andreas Rheinhardt wrote:
> Unnecessary: av_freep() resets ctx->buffer and resetting buffer_size is
> unnecessary.

Here, you claim that resetting buffer_size is unnecessary but above you 
insist it is necessary. I'm confused here.

Leo Izen (thebombzen)




More information about the ffmpeg-devel mailing list