[Openmp-commits] [openmp] r287551 - Fix for D25504 - segfault because of double free()-ing in shutdown code.

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Mon Nov 21 08:18:57 PST 2016


Author: jlpeyton
Date: Mon Nov 21 10:18:57 2016
New Revision: 287551

URL: http://llvm.org/viewvc/llvm-project?rev=287551&view=rev
Log:
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

Modified:
    openmp/trunk/runtime/src/kmp_runtime.c

Modified: openmp/trunk/runtime/src/kmp_runtime.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_runtime.c?rev=287551&r1=287550&r2=287551&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_runtime.c (original)
+++ openmp/trunk/runtime/src/kmp_runtime.c Mon Nov 21 10:18:57 2016
@@ -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 );




More information about the Openmp-commits mailing list