diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-10-11 22:03:19 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-11-04 01:08:24 +0100 |
commit | 5ae87280e219e843c71201c580780e8e30083559 (patch) | |
tree | f469d27a43cc68da68afd45c7f5227270a163076 | |
parent | 7d02df7036d4efef1410a840b3e5ffb7a8c42cf1 (diff) | |
download | ffmpeg-5ae87280e219e843c71201c580780e8e30083559.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>
-rw-r--r-- | libavutil/mem.c | 4 |
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 |