[Openmp-commits] [PATCH] D35497: Cleanup: nullify pointer after memory freeing

Phabricator via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Jul 18 01:30:42 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL308274: OpenMP RTL cleanup: nullify pointer after memory freeing (authored by achurbanov).

Changed prior to commit:
  https://reviews.llvm.org/D35497?vs=106903&id=107029#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35497

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


Index: openmp/trunk/runtime/src/kmp_affinity.h
===================================================================
--- openmp/trunk/runtime/src/kmp_affinity.h
+++ openmp/trunk/runtime/src/kmp_affinity.h
@@ -688,8 +688,11 @@
       : 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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35497.107029.patch
Type: text/x-patch
Size: 569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20170718/1d13251b/attachment.bin>


More information about the Openmp-commits mailing list