[FFmpeg-devel] [PATCH] [RFC] libavutil/mem.c: Check return value of posix_memalign

Reimar Döffinger Reimar.Doeffinger
Fri Feb 13 16:54:42 CET 2009


On Fri, Feb 13, 2009 at 03:47:23PM +0000, M?ns Rullg?rd wrote:
> > libavutil/mem.c: In function ?av_malloc?:
> > libavutil/mem.c:66: warning: ignoring return value of ?posix_memalign?,
> > declared with attribute warn_unused_result
> 
> That warning is bogus.  If posix_memalign() fails, memalign() will too
> since they are likely to be the same function.  We set the pointer to
> NULL before the call, so if it fails, we return NULL as we're supposed
> to.

Well, if you are pedantic you here assume that posix_memalign will not
modify ptr if it fails (or at least not set it != NULL), but that
actually does not seem to be guaranteed by POSIX (it doesn't say
anything about the value of ptr when an error is returned...).




More information about the ffmpeg-devel mailing list