[Openmp-commits] [openmp] r308274 - OpenMP RTL cleanup: nullify pointer after memory freeing

Andrey Churbanov via Openmp-commits openmp-commits at lists.llvm.org
Tue Jul 18 01:30:03 PDT 2017


Author: achurbanov
Date: Tue Jul 18 01:30:03 2017
New Revision: 308274

URL: http://llvm.org/viewvc/llvm-project?rev=308274&view=rev
Log:
OpenMP RTL cleanup: nullify pointer after memory freeing

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

Modified:
    openmp/trunk/runtime/src/kmp_affinity.h

Modified: openmp/trunk/runtime/src/kmp_affinity.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_affinity.h?rev=308274&r1=308273&r2=308274&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_affinity.h (original)
+++ openmp/trunk/runtime/src/kmp_affinity.h Tue Jul 18 01:30:03 2017
@@ -688,8 +688,11 @@ public:
       : maxLevels(7), depth(1), uninitialized(not_initialized), resizing(0) {}
 
   void fini() {
-    if (!uninitialized && numPerLevel)
+    if (!uninitialized && numPerLevel) {
       __kmp_free(numPerLevel);
+      numPerLevel = NULL;
+      uninitialized = not_initialized;
+    }
   }
 
   void init(AddrUnsPair *adr2os, int num_addrs) {




More information about the Openmp-commits mailing list