[FFmpeg-devel] size=0, but av_malloc(1)
michael at niedermayer.cc
Wed Mar 23 15:31:38 CET 2016
On Tue, Mar 22, 2016 at 11:43:50PM -0700, Chris Cunningham wrote:
> Hey Group,
> I'm seeing an interesting pattern  where we allocate 1 byte in places
> where I would expect no allocation to be necessary. Why is this being done?
>  https://github.com/FFmpeg/FFmpeg/blob/master/libavutil/mem.c#L136
to add another reason why malloc(0) _can_ be a problem
malloc(0) can return NULL or non NULL whchever way libc prefers
this makes reproducing bugreports harder if the developer and user
have differening libcs
also error checks become more complex if NULL can be a non error
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Dictatorship: All citizens are under surveillance, all their steps and
actions recorded, for the politicians to enforce control.
Democracy: All politicians are under surveillance, all their steps and
actions recorded, for the citizens to enforce control.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 181 bytes
Desc: Digital signature
More information about the ffmpeg-devel