Mentions légales du service

Skip to content
Snippets Groups Projects
Commit bef163a8 authored by Jonathan Peyton's avatar Jonathan Peyton
Browse files

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


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@273276 91177308-0d34-0410-b5e6-96231b3b80d8
parent 1860d030
No related branches found
No related tags found
No related merge requests found
......@@ -111,9 +111,13 @@ void * kmp_aligned_malloc( size_t sz, size_t a ) {
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 ); }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment