aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-11 22:03:19 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-11 22:03:19 +0200
commitfc11927890f38445a950b453d24928525da0e61a (patch)
tree55e2994b3236602e16bbd1cfc1dbf5e4375b7e7c
parent96bc6485bc929741827fc0f08ef06bea662a3eea (diff)
downloadffmpeg-fc11927890f38445a950b453d24928525da0e61a.tar.gz
mem: fix memalign hack av_realloc()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavutil/mem.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavutil/mem.c b/libavutil/mem.c
index a58f432a2c..a53676c553 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -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