mesa: check for posix_memalign() errors
authorpontus lidman <pontus.lidman@27m.se>
Mon, 29 Nov 2010 16:20:41 +0000 (09:20 -0700)
committerBrian Paul <brianp@vmware.com>
Mon, 29 Nov 2010 16:20:41 +0000 (09:20 -0700)
Signed-off-by: Brian Paul <brianp@vmware.com>
src/mesa/main/imports.c

index bcca4edc1aa77dd3b898a1c5ea355f93672adba0..cefbf4d8c98772c1543167e97f1523383bad4733 100644 (file)
@@ -88,7 +88,8 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment)
 #if defined(HAVE_POSIX_MEMALIGN)
    void *mem;
    int err = posix_memalign(& mem, alignment, bytes);
-   (void) err;
+   if (err)
+      return NULL;
    return mem;
 #elif defined(_WIN32) && defined(_MSC_VER)
    return _aligned_malloc(bytes, alignment);