[FFmpeg-devel] [PATCH] Avoid pointless check before calling free
Måns Rullgård
mans
Thu Feb 3 02:55:27 CET 2011
Cl?ment B?sch <ubitux at gmail.com> writes:
> On Thu, Feb 03, 2011 at 01:43:04AM +0000, M?ns Rullg?rd wrote:
>> Cl?ment B?sch <ubitux at gmail.com> writes:
>>
>> > Note that I didn't touch the av_freep ones since I'm not sure of the real
>> > benefit.
>>
>> Did you find similar pointless checks related to av_freep, or what do
>> you mean?
>>
>> The purpose of av_freep() is to free the buffer and set the pointer to
>> NULL as an extra precaution against accessing freed memory and double
>> frees.
>
> Yes, there is a few if (p) av_freep(&p) but I did not make the changes
> since a I thought assigning to NULL a pointer already NULL may not be
> justified. I can provide another patch tomorrow for those if you wish, but
> as I meant to say, I'm not sure it's worth the change.
Please do. av_freep(&null_pointer) is perfectly safe.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list