[FFmpeg-devel] [PATCH 1/3] Replace DUP_DATA & memset with 0 by av_mallocz

Nicolas George nicolas.george at normalesup.org
Mon Sep 17 18:56:58 CEST 2012


Le jour du Génie, an CCXX, Andrey Utkin a écrit :
> Offtop childish question: does malloc(struct_size * number) always alloc
> same size as calloc(number, struct_size)? I.e. is having two params in
> calloc() a nonsense?

No: struct_size * number can overflow and allocate less memory than
intended. calloc with its two arguments checks the overflow and returns an
error.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120917/a319d9cd/attachment.asc>


More information about the ffmpeg-devel mailing list