[Openmp-commits] [PATCH] D72779: [OpenMP][Tool] Fix memory leak and double-allocation

Joachim Protze via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Jan 15 17:56:58 PST 2020


protze.joachim updated this revision to Diff 238401.
protze.joachim added a comment.

You are right, with the current usage a local variable works.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72779/new/

https://reviews.llvm.org/D72779

Files:
  openmp/tools/archer/ompt-tsan.cpp


Index: openmp/tools/archer/ompt-tsan.cpp
===================================================================
--- openmp/tools/archer/ompt-tsan.cpp
+++ openmp/tools/archer/ompt-tsan.cpp
@@ -114,7 +114,6 @@
 }
 #endif
 ArcherFlags *archer_flags;
-TsanFlags *tsan_flags;
 
 // The following definitions are pasted from "llvm/Support/Compiler.h" to allow
 // the code
@@ -862,10 +861,8 @@
 static int ompt_tsan_initialize(ompt_function_lookup_t lookup,
                                 int device_num,
                                 ompt_data_t *tool_data) {
-  const char *options = getenv("ARCHER_OPTIONS");
-  archer_flags = new ArcherFlags(options);
-  options = getenv("TSAN_OPTIONS");
-  tsan_flags = new TsanFlags(options);
+  const char *options = getenv("TSAN_OPTIONS");
+  TsanFlags *tsan_flags = new TsanFlags(options);
 
   ompt_set_callback_t ompt_set_callback =
       (ompt_set_callback_t)lookup("ompt_set_callback");
@@ -903,6 +900,7 @@
         stderr,
         "Warning: please export TSAN_OPTIONS='ignore_noninstrumented_modules=1' "
         "to avoid false positive reports from the OpenMP runtime.!\n");
+  delete tsan_flags;
   return 1; // success
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72779.238401.patch
Type: text/x-patch
Size: 1175 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200116/685e5e98/attachment.bin>


More information about the Openmp-commits mailing list