diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-07-27 11:09:41 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-07-27 11:09:41 +0000 |
commit | c07a22fb9fc5cfa24b5b80f83e8f08b17937ca97 (patch) | |
tree | 684ae916d4b19c108b2b0a34c6e12e0c850b5413 /libavcodec/mem.c | |
parent | e071139a9664fda76177a27578aed677ca6fb71a (diff) | |
download | ffmpeg-c07a22fb9fc5cfa24b5b80f83e8f08b17937ca97.tar.gz |
realloc(NULL) fix
Originally committed as revision 3351 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mem.c')
-rw-r--r-- | libavcodec/mem.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/mem.c b/libavcodec/mem.c index 35c8305033..9eaa09ed62 100644 --- a/libavcodec/mem.c +++ b/libavcodec/mem.c @@ -95,7 +95,9 @@ void *av_realloc(void *ptr, unsigned int size) { #ifdef MEMALIGN_HACK //FIXME this isnt aligned correctly though it probably isnt needed - int diff= ptr ? ((char*)ptr)[-1] : 0; + int diff; + if(!ptr) return av_malloc(size); + diff= ((char*)ptr)[-1]; return realloc(ptr - diff, size + diff) + diff; #else return realloc(ptr, size); |