[FFmpeg-devel] Patch: explicitly initialize AVFormatContext *ic = NULL

avcoder ffmpeg
Fri Jul 10 04:41:48 CEST 2009


On Fri, Jul 10, 2009 at 10:34 AM, Michael Niedermayer<michaelni at gmx.at> wrote:
> On Fri, Jul 10, 2009 at 10:20:44AM +0800, avcoder wrote:
>> On Fri, Jul 10, 2009 at 10:05 AM, Michael Niedermayer<michaelni at gmx.at> wrote:
>> > On Thu, Jul 09, 2009 at 10:59:56PM +0800, avcoder wrote:
>> >> Dear:
>> >>
>> >> "
>> >> ? ? Fix mem leak when user preallocates an AVFormatContext, passes it to
>> >> ? ? av_open_input_file(), but the file does not exist.
>> >> ? ? Patch by Art Clarke a$(surname) xuggle com
>> >>
>> >>
>> >> ? ? git-svn-id: file:///var/local/repositories/ffmpeg/trunk at 19370
>> >> 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
>> >> "
>> >>
>> >> The commit will cause error when calling av_freep() at the end of
>> >> av_open_input_file() if we fail to explicitly initialize the args:
>> >> AVFormatContext **ic_ptr in calling routine.
>> >
>> > then the patch should be reverted
>> >
>>
>> I agree!
>>
>> But IMHO, Initialize AVForamatContext *ic = NULL is a safe coding
>> style, and this modification unifies coding style with other
>> av_open_input_file() usages in ffmpeg internal source code
>
> The problem is that =NULL is in the applications (ffmpeg/ffplay/...)
> and the ABI/API does not seem to require it, adding that requirement
> makes libav incompatible with old applications ...

I see, so revert is a better choice

Thanks

-- 
-----------------------------------------------------------------------------------------
My key fingerprint: d1:03:f5:32:26:ff:d7:3c:e4:42:e3:51:ec:92:78:b2
Inspired by http://www.nextplayer.net. Your potential. Our passion.



More information about the ffmpeg-devel mailing list