From 8a52c44d15c88761971a5f826b4ac368ba8d1817 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 1 Dec 2010 02:00:41 -0800 Subject: [PATCH] Don'f fail if realloc returns NULL for 0 sizes --- OpenAL32/alBuffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index 048f795c..3cde5698 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -1381,7 +1381,7 @@ static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei s return AL_OUT_OF_MEMORY; temp = realloc(ALBuf->data, newsize); - if(!temp) return AL_OUT_OF_MEMORY; + if(!temp && newsize) return AL_OUT_OF_MEMORY; ALBuf->data = temp; ALBuf->size = newsize; @@ -1408,7 +1408,7 @@ static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei s return AL_OUT_OF_MEMORY; temp = realloc(ALBuf->data, newsize); - if(!temp) return AL_OUT_OF_MEMORY; + if(!temp && newsize) return AL_OUT_OF_MEMORY; ALBuf->data = temp; ALBuf->size = newsize; -- 2.11.4.GIT