summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2016-11-21 16:18:57 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2016-11-21 16:18:57 +0000
commit7ca7ef0478003e2649963246aee7f07b6cb95843 (patch)
tree67cb42e7626c8dacfc673261523e64f69a922992
parent13e45e135f8948eb84432ac4e66284d96763b94d (diff)
downloadbcm5719-llvm-7ca7ef0478003e2649963246aee7f07b6cb95843.tar.gz
bcm5719-llvm-7ca7ef0478003e2649963246aee7f07b6cb95843.zip
Fix for D25504 - segfault because of double free()-ing in shutdown code.
Paul Osmialowski pointed out a double free bug in shutdown code. This patch Moves the freeing of the implicit task to above the freeing of all fast memory to prevent the double-free issue. Differential Revision: https://reviews.llvm.org/D26860 llvm-svn: 287551
-rw-r--r--openmp/runtime/src/kmp_runtime.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/openmp/runtime/src/kmp_runtime.c b/openmp/runtime/src/kmp_runtime.c
index c875f5800cc..da602d9bc0d 100644
--- a/openmp/runtime/src/kmp_runtime.c
+++ b/openmp/runtime/src/kmp_runtime.c
@@ -5707,6 +5707,8 @@ __kmp_reap_thread(
--__kmp_thread_pool_nth;
}; // if
+ __kmp_free_implicit_task(thread);
+
// Free the fast memory for tasking
#if USE_FAST_MEMORY
__kmp_free_fast_memory( thread );
@@ -5762,7 +5764,6 @@ __kmp_reap_thread(
}; // if
#endif /* KMP_AFFINITY_SUPPORTED */
- __kmp_free_implicit_task(thread);
__kmp_reap_team( thread->th.th_serial_team );
thread->th.th_serial_team = NULL;
__kmp_free( thread );
OpenPOWER on IntegriCloud