[FFmpeg-devel] [PATCH] Use posix_memalign() instead of memalign()
Fri Dec 19 20:23:37 CET 2008
On Fri, Dec 19, 2008 at 08:41:41AM -0200, Ramiro Polla wrote:
> >> --- libavutil/mem.c (revision 16223)
> >> +++ libavutil/mem.c (working copy)
> >> @@ -57,6 +58,9 @@
> >> +#elif defined (HAVE_POSIX_MEMALIGN)
> >> + if(posix_memalign(&ptr,16,size))
> >> + ptr = NULL;
> >> #elif defined (HAVE_MEMALIGN)
> > NULL? Am I missing the obvious here?
> According to :
> Upon successful completion, posix_memalign() shall return zero;
> otherwise, an error number shall be returned to indicate the error.
> So it fails on non-zero, and ptr would be uninitialized.
> I think
> + ptr = NULL;
> + posix_memalign(&ptr,16,size);
> has the same effect and avoids an if.
Yes, that would be more straightforward.
More information about the ffmpeg-devel