aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-11 22:03:19 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-11-06 19:49:12 +0100
commit36e4be0a0adc18358a59043167a55da8eac16023 (patch)
treef0aedb18e64d8254d789f463adc44f3f6b702b23
parentc603cf51704714a3b9e1d3efa78bd4627d4b9e74 (diff)
downloadffmpeg-36e4be0a0adc18358a59043167a55da8eac16023.tar.gz
mem: fix memalign hack av_realloc()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit fc11927890f38445a950b453d24928525da0e61a) Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 5ae87280e219e843c71201c580780e8e30083559) 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 741450b53f..1ce0b778cc 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -113,7 +113,9 @@ void *av_realloc(void *ptr, unsigned int 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);
#endif