Commit c8981edd authored by Michael Niedermayer's avatar Michael Niedermayer

Only add 1 byte to av_malloc(0) when it actually returned NULL

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 91ff05f6
...@@ -71,8 +71,6 @@ void *av_malloc(size_t size) ...@@ -71,8 +71,6 @@ void *av_malloc(size_t size)
/* let's disallow possible ambiguous cases */ /* let's disallow possible ambiguous cases */
if(size > (INT_MAX-32) ) if(size > (INT_MAX-32) )
return NULL; return NULL;
else if(!size)
size= 1;
#if CONFIG_MEMALIGN_HACK #if CONFIG_MEMALIGN_HACK
ptr = malloc(size+32); ptr = malloc(size+32);
...@@ -113,6 +111,8 @@ void *av_malloc(size_t size) ...@@ -113,6 +111,8 @@ void *av_malloc(size_t size)
#else #else
ptr = malloc(size); ptr = malloc(size);
#endif #endif
if(!ptr && !size)
ptr= av_malloc(1);
return ptr; return ptr;
} }
......
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