[Openmp-commits] [PATCH] D35497: Cleanup: nullify pointer after memory freeing
Andrey Churbanov via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Mon Jul 17 11:07:52 PDT 2017
AndreyChurbanov created this revision.
AndreyChurbanov added a project: OpenMP.
Static library crashed sometimes on tests those cause library to repeatedly start up and shut down with affinity enabled (e.g. non-OMP thread creates / joins many OMP threads one by one).
Repository:
rL LLVM
https://reviews.llvm.org/D35497
Files:
runtime/src/kmp_affinity.h
Index: runtime/src/kmp_affinity.h
===================================================================
--- runtime/src/kmp_affinity.h
+++ 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.106903.patch
Type: text/x-patch
Size: 530 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20170717/cf1e9561/attachment-0001.bin>
More information about the Openmp-commits
mailing list