Mesa (master): mesa: check for posix_memalign() errors

Brian Paul brianp at kemper.freedesktop.org
Mon Nov 29 16:20:56 UTC 2010


Module: Mesa
Branch: master
Commit: b1097607db58ddaa91281e364dbb4aa53d904052
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b1097607db58ddaa91281e364dbb4aa53d904052

Author: pontus lidman <pontus.lidman at 27m.se>
Date:   Mon Nov 29 09:20:41 2010 -0700

mesa: check for posix_memalign() errors

Signed-off-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/main/imports.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index bcca4ed..cefbf4d 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -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);




More information about the mesa-commit mailing list