From a90de11dba816f57d01cf10b02eaaf90de24d5bb Mon Sep 17 00:00:00 2001 From: Patrik Kullman Date: Sat, 21 Feb 2009 20:38:27 +0000 Subject: [PATCH] Check return value of posix_memalign and explicitly set pointer to NULL if it fails, patch by Patrik Kullman, patrik yes nu. Originally committed as revision 17495 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavutil/mem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavutil/mem.c b/libavutil/mem.c index f21e918e15..741450b53f 100644 --- a/libavutil/mem.c +++ b/libavutil/mem.c @@ -63,7 +63,8 @@ void *av_malloc(unsigned int size) ptr = (char*)ptr + diff; ((char*)ptr)[-1]= diff; #elif HAVE_POSIX_MEMALIGN - posix_memalign(&ptr,16,size); + if (posix_memalign(&ptr,16,size)) + ptr = NULL; #elif HAVE_MEMALIGN ptr = memalign(16,size); /* Why 64?