Commit 8b83b9de authored by michael's avatar michael

trying to fix av_realloc()


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@5996 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent c4a5b9d8
...@@ -50,7 +50,7 @@ void *av_malloc(unsigned int size) ...@@ -50,7 +50,7 @@ void *av_malloc(unsigned int size)
#endif #endif
/* let's disallow possible ambiguous cases */ /* let's disallow possible ambiguous cases */
if(size > (INT_MAX-16) ) if(size > (INT_MAX-16) || !size)
return NULL; return NULL;
#ifdef MEMALIGN_HACK #ifdef MEMALIGN_HACK
...@@ -109,13 +109,15 @@ void *av_realloc(void *ptr, unsigned int size) ...@@ -109,13 +109,15 @@ void *av_realloc(void *ptr, unsigned int size)
#ifndef MEMALIGN_HACK #ifndef MEMALIGN_HACK
ptr= realloc(ptr, size); ptr= realloc(ptr, size);
if(((int)ptr&15) || !ptr) assert(((int)((void*)0)&15) == 0); //for the null pointer pedants
if(!((int)ptr&15))
return ptr; return ptr;
#endif #endif
ptr2= av_malloc(size); ptr2= av_malloc(size);
if(ptr && ptr2) if(ptr && ptr2)
memcpy(ptr2, ptr, size); memcpy(ptr2, ptr, size);
if(ptr2 || !size)
av_free(ptr); av_free(ptr);
return ptr2; return ptr2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment