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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-05-07 15:28:39 +02:00
parent 91ff05f6ac
commit c8981edd90
1 changed files with 2 additions and 2 deletions

View File

@ -71,8 +71,6 @@ void *av_malloc(size_t size)
/* let's disallow possible ambiguous cases */
if(size > (INT_MAX-32) )
return NULL;
else if(!size)
size= 1;
#if CONFIG_MEMALIGN_HACK
ptr = malloc(size+32);
@ -113,6 +111,8 @@ void *av_malloc(size_t size)
#else
ptr = malloc(size);
#endif
if(!ptr && !size)
ptr= av_malloc(1);
return ptr;
}