Fixed memory use-after-free problem.

Bug reported in https://bugs.llvm.org/show_bug.cgi?id=42269.
Freeing of the contention group (CG) stucture by master thread looks wrong,
because workers can leave the CG later on. Intead the freeing
is now done by the last thread leaving the CG.

Differential Revision: https://reviews.llvm.org/D63599


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@364456 91177308-0d34-0410-b5e6-96231b3b80d8
2 files changed