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

Måns Rullgård mans
Fri Feb 13 22:48:46 CET 2009


Michael Niedermayer <michaelni at gmx.at> writes:

> On Fri, Feb 13, 2009 at 07:37:16PM +0000, M?ns Rullg?rd wrote:
>> Patrik Kullman <patrik at yes.nu> writes:
>> 
>> > Index: libavutil/mem.c
>> > ===================================================================
>> > --- libavutil/mem.c	(revision 17211)
>> > +++ libavutil/mem.c	(working copy)
>> > @@ -63,7 +63,8 @@
>> >      ptr = (char*)ptr + diff;
>> >      ((char*)ptr)[-1]= diff;
>> >  #elif HAVE_POSIX_MEMALIGN
>> > -    posix_memalign(&ptr,16,size);
>> > +    if (posix_memalign(&ptr,16,size))
>> > +        ptr = NULL;
>> >  #elif HAVE_MEMALIGN
>> >      ptr = memalign(16,size);
>> >      /* Why 64?
>> 
>> Now we're just waiting for the maintainer to give his approval (or not).
>
> iam fine with it though i must say ive never been a friend of
> posix_memalign() memalign() itself works fine and doesnt need such
> obscure checks

memalign() only work if it exists, and it's not standard.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list