[FFmpeg-devel] size=0, but av_malloc(1)
Michael Niedermayer
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 [0][1] where we allocate 1 byte in places
> where I would expect no allocation to be necessary. Why is this being done?
>
> [0] https://github.com/FFmpeg/FFmpeg/blob/master/libavutil/mem.c#L136
> [1]
> https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/oggparsevorbis.c#L286
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
return value
[...]
--
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...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160323/e0b01366/attachment.sig>
More information about the ffmpeg-devel
mailing list