-#ifndef MEMALIGN_HACK
- ptr= realloc(ptr, size);
-assert(((int)((void*)0)&15) == 0); //for the null pointer pedants
- if(!((int)ptr&15))
- return ptr;
+#ifdef MEMALIGN_HACK
+ //FIXME this isn't aligned correctly, though it probably isn't needed
+ if(!ptr) return av_malloc(size);
+ diff= ((char*)ptr)[-1];
+ return realloc(ptr - diff, size + diff) + diff;
+#else
+ return realloc(ptr, size);