[Ffmpeg-devel] [RFC] another attempt at memalign realloc
Thu Dec 7 13:09:51 CET 2006
On Thu, Dec 07, 2006 at 12:55:47PM +0100, Michael Niedermayer wrote:
> > Too bad I can't find any good solution for the
> > non-memalign-hack case.
> p= realloc(p, size);
> return p;
> p2= av_malloc(size);
> memcpy(p2, p, size);
> return p2;
> btw, this one with a small modification should work in the memalign-hack
> case too i think, would simplify the code though it would be slower in the
> memalign-hack case ...
Yes, I was thinking about that, and probably it is fine for ffmpeg, but
it does not meet this part of realloc:
"If realloc() fails the original block is left untouched".
If we do it this change, at least we must free p always and say
"If av_realloc() fails the original block is freed".
Unless of course I miss something *g*
More information about the ffmpeg-devel