[vlc-devel] [PATCH] avformat: check malloc() result

Denis Charmet typx at dinauz.org
Mon Feb 29 10:33:40 CET 2016


On 2016-02-27 11:45, Zhao Zhili wrote:
> As Rémi Denis-Courmont says
> 
>>> + p_sys = malloc( sizeof( filter_sys_t ) );
>>> + if( p_sys == NULL) {
>>> + return VLC_ENOMEM;
>>> + }
>> 
>> Not needed since your whole state is a single pointer.
> 
> https://patches.videolan.org/patch/12164/ [4]
> 

Which, unless I misunderstand, means that you don't need to allocate 
anything since you can do p_sys = (filter_sys_t*) p_chain; not that you 
don't need to check memory allocation for small sizes.

Regards,
-- 
Denis Charmet - TypX
Le mauvais esprit est un art de vivre


More information about the vlc-devel mailing list