aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/mem.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-05-07 15:28:39 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-05-07 16:21:54 +0200
commitc8981edd902e40185b80ddb77a229104deb7c7e1 (patch)
tree00281db96b9401688bdd400ccb82801ade9f47fa /libavutil/mem.c
parent91ff05f6ac5c65a6cd3701d5a7cdcfb6ccfd87e4 (diff)
downloadffmpeg-c8981edd902e40185b80ddb77a229104deb7c7e1.tar.gz
Only add 1 byte to av_malloc(0) when it actually returned NULL
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/mem.c')
-rw-r--r--libavutil/mem.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavutil/mem.c b/libavutil/mem.c
index 83e8c35561..42beb503a1 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -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;
}