[Openmp-commits] [openmp] r273276 - Bug fix for segfault in stubs library
Jonathan Peyton via Openmp-commits
openmp-commits at lists.llvm.org
Tue Jun 21 08:39:08 PDT 2016
Author: jlpeyton
Date: Tue Jun 21 10:39:08 2016
New Revision: 273276
URL: http://llvm.org/viewvc/llvm-project?rev=273276&view=rev
Log:
Bug fix for segfault in stubs library
There was a segfault in the stubs library in posix_memalign because
of a bad parameter. The fix is to send address of the pointer as a
parameter. Also added check of result of posix_memalign.
Patch by Andrey Churbanov.
Differential Revision: http://reviews.llvm.org/D21529
Modified:
openmp/trunk/runtime/src/kmp_stub.c
Modified: openmp/trunk/runtime/src/kmp_stub.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_stub.c?rev=273276&r1=273275&r2=273276&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_stub.c (original)
+++ openmp/trunk/runtime/src/kmp_stub.c Tue Jun 21 10:39:08 2016
@@ -111,9 +111,13 @@ void * kmp_aligned_malloc( size_t sz, si
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 ); }
More information about the Openmp-commits
mailing list