Browse Source

realloc(NULL) fix

Originally committed as revision 3351 to svn://svn.ffmpeg.org/ffmpeg/trunk
tags/v0.5
Michael Niedermayer 21 years ago
parent
commit
c07a22fb9f
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      libavcodec/mem.c

+ 3
- 1
libavcodec/mem.c View File

@@ -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);


Loading…
Cancel
Save