mem: fix memalign hack av_realloc()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-10-11 22:03:19 +02:00
parent 96bc6485bc
commit fc11927890
1 changed files with 3 additions and 1 deletions

View File

@ -137,7 +137,9 @@ void *av_realloc(void *ptr, size_t size)
//FIXME this isn't aligned correctly, though it probably isn't needed
if(!ptr) return av_malloc(size);
diff= ((char*)ptr)[-1];
return (char*)realloc((char*)ptr - diff, size + diff) + diff;
ptr= realloc((char*)ptr - diff, size + diff);
if(ptr) ptr = (char*)ptr + diff;
return ptr;
#else
return realloc(ptr, size + !size);
#endif