Skip to content

Commit

Permalink
Fix for D25504 - segfault because of double free()-ing in shutdown code.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jpeyton52 committed Nov 21, 2016
1 parent 13e45e1 commit 7ca7ef0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion openmp/runtime/src/kmp_runtime.c
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit 7ca7ef0

Please sign in to comment.