[FFmpeg-devel] [PATCH] Use posix_memalign() instead of memalign()
Wed Jan 7 05:35:20 CET 2009
On Fri, Dec 19, 2008 at 5:23 PM, Diego Biurrun <diego at biurrun.de> wrote:
> 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.
New patch attached.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1694 bytes
Desc: not available
More information about the ffmpeg-devel