[FFmpeg-devel] [PATCH v2 3/7] avformat/hlsenc: Check some unchecked allocations

Steven Liu lq at chinaffmpeg.org
Thu Apr 9 12:07:27 EEST 2020



> 2020年4月9日 下午4:49,Nicolas George <george at nsup.org> 写道:
> 
> Steven Liu (12020-04-09):
>> It’s unnecessary here,
>> I have checked all strdup return checker in hlsenc some month ago, and double check the workflow in update_master_pl_info,
>> It's the safe whether you check the strdup or not.
>> Reference commit id: 61aa77272a25d83e5ce5c63d93c64bb9a3e15557
> 
> Honestly, I think that relying on string functions to all check for NULL
> to guard against a memory allocation failure is very terrible design.
> More importantly, it is fragile: it takes only one string function that
> does not support NULL to make it crash. And since it is neither obvious
> nor documented in the code (I am not talking about the doxy of the
> string functions, I am talking about the fact that it relies on it), you
> will endlessly get patches like that to restore them. And if somebody
> decides to copy the code but is not careful about the string function it
> uses, again, crash.
> 
> I vote for properly checking memory allocations as they happen.
I think every body have themselves reason to checking memory and remove the checking at here.
Whatever for me you can add them here for somebody copy, other body remove them 
some days(maybe long time later) some body remove remove the for unnecessary processing.

Thanks

Steven Liu



More information about the ffmpeg-devel mailing list