[Openmp-commits] [PATCH] D21529: Bugfix for segfault in stubs library

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Tue Jun 21 08:46:01 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL273276: Bug fix for segfault in stubs library (authored by jlpeyton).

Changed prior to commit:
  http://reviews.llvm.org/D21529?vs=61289&id=61383#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21529

Files:
  openmp/trunk/runtime/src/kmp_stub.c

Index: openmp/trunk/runtime/src/kmp_stub.c
===================================================================
--- openmp/trunk/runtime/src/kmp_stub.c
+++ openmp/trunk/runtime/src/kmp_stub.c
@@ -111,9 +111,13 @@
     errno = ENOSYS; // not supported
     return NULL;    // no standard aligned allocator on Windows (pre - C11)
 #else
-    void **res;
-    errno = posix_memalign( res, a, sz );
-    return *res;
+    void *res;
+    int err;
+    if( err = posix_memalign( &res, a, sz ) ) {
+        errno = err; // can be EINVAL or ENOMEM
+        return NULL;
+    }
+    return res;
 #endif
 }
 void * kmp_calloc( size_t nelem, size_t elsize ) { i; return calloc( nelem, elsize ); }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21529.61383.patch
Type: text/x-patch
Size: 686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20160621/6b51286b/attachment.bin>


More information about the Openmp-commits mailing list