[FFmpeg-devel] [PATCH] Added support for MB_INFO

Timo Rothenpieler timo at rothenpieler.org
Fri Jun 17 13:34:33 EEST 2022


On 17.06.2022 12:15, Carotti, Elias wrote:
> Hi,
> thanks for pointing out the printf. That's a left over which I removed.
> 
> I am not clear on the possible leak you are hinting at.
> The new side information only passes two pointers to libx264, the first
> one being a buffer with the flags and a pointer to a deallocator which
> may be NULL.
> 
> If the deallocator is not NULL libx264 we're yielding the deallocation
> responsibility to libx264, otherwise the ownership of the buffer and,
> as such, the responsibility for the deallocation remains with the
> caller.
> As such, the only possibility for a leak seems to me due to a
> programming error.
> Is that what you were asking or am I missing something else?
> 
> Please find attached the updated patch.
> 
> Elias
> 

Yes, exactly. It relies on x264 to free it.
What happens if x264 is not involved, but some other encoder, which does 
not check for that kind of side data?

How does the caller know that the data was consumed, and the ownership 
passed on?
The only sane way would be for the caller to hand over the ownership to 
ffmpeg, which then takes care of making sure it gets freed.


More information about the ffmpeg-devel mailing list