Check return value of posix_memalign and explicitly set pointer to NULL if it
authorPatrik Kullman <patrik@yes.nu>
Sat, 21 Feb 2009 20:38:27 +0000 (20:38 +0000)
committerDiego Biurrun <diego@biurrun.de>
Sat, 21 Feb 2009 20:38:27 +0000 (20:38 +0000)
fails, patch by Patrik Kullman, patrik yes nu.

Originally committed as revision 17495 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavutil/mem.c

index f21e918..741450b 100644 (file)
@@ -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?