[FFmpeg-devel] [PATCH] lavc/huffyuvdec: fix mem leak in case of init failure

Lukasz Marek lukasz.m.luki2 at gmail.com
Mon Nov 24 01:26:09 CET 2014


On 24.11.2014 00:52, Michael Niedermayer wrote:
>>> i think calling decode_end() is better than duplicating what it does
>>> if it works
>>
>> I have no opinion about that, but changed. I had to move decode_end above.
>> I could add prototype but from these 2 I prefer move it as it is not long.
>>
>
>> Perfectly decode end callback could be called in avcodec_open2 on
>> fail but I'm not sure every codec under any circumstances is secure
>> to call it twice.
>
> maybe a libavcodec private flag could be added to AVCodec.capabilities
> to indicate that calling "end" is safe/needed for open failures
> and then call it in case of error & that flag being set

Maybe, but not sure it is worth the effort. Many codec seems to do that.
The leaking one doesn't :)
It is not to hard call one function in implementation and it is easier 
to read for others.

I'm trying to write some tests that allocs/deallocs codecs with "random" 
options to find leaks/crashes and so far only few codecs leaked. Maybe 
after this patch is created it will be safer to introduce that auto 
deinit mechanism.

You didn't comment patch itself.




More information about the ffmpeg-devel mailing list