OpenMPToolsInterface / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Note: the repository does not accept github pull requests at this moment. Please submit your patches at http://reviews.llvm.org.
http://llvm.org
2 stars 4 forks source link

Replace KMP_INTERNAL_FREE by __kmp_free for freeing ompd_env_block #2

Closed jinisusan closed 4 years ago

jinisusan commented 4 years ago

Since ompd_env_block was allocated using __kmp_allocate(), it needs to be freed using __kmp_free(). Trying to free ompd_env_block using KMP_INTERNAL_FREE() was resulting in a crash with 'munmap_chunk(): invalid pointer'. This patch fixes this issue.

I have not checked if there are other cases where __kmp_allocate/KMP_INTERNAL_MALLOC/__kmp_free/KMP_INTERNAL_FREE have been mixed.

Also, freeing the ompd_env_block is guarded by "if (ompd_state)", while the corresponding __kmp_allocate() is not (since ompd_state gets set later). This will be fixed in a later patch.