[Ffmpeg-devel] [RFC] another attempt at memalign realloc
Thu Dec 7 20:01:07 CET 2006
On Thu, Dec 07, 2006 at 08:50:14PM +0200, Oded Shimon wrote:
> On Thu, Dec 07, 2006 at 07:05:55PM +0100, Reimar D?ffinger wrote:
> > Actually, there is a rather obvious solution.
> > Disadvantage: av_realloc without MEMALIGN_HACK now _always_ has the time
> > and space costs of av_malloc.
> > - return realloc(ptr, size);
> > + p2 = av_malloc(size);
> > + if (!p2) return NULL;
> > + ptr = realloc(ptr, size);
> > + if(!((long)ptr&15))
> > + return ptr;
> .... didn't you just loose p2?
> I assume you meant to put the av_malloc line AFTER this line... ?
Certainly not! Then we would have no way back if the malloc fails, which
conflicts with how realloc is supposed to behave, that's exactly the
Though you are right, I'm missing a av_free.
More information about the ffmpeg-devel