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

avcoder ffmpeg
Fri Jul 10 04:20:44 CEST 2009


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

-- 
-----------------------------------------------------------------------------------------
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