[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 09:25:16 PST 2020


protze.joachim created this revision.
protze.joachim added reviewers: jdoerfert, Hahnfeld.
Herald added a subscriber: guansong.
Herald added a project: OpenMP.

Fix the memory leak pointed out in https://reviews.llvm.org/D70412.
And a second one due to double-allocation.


Repository:
  rG LLVM Github Monorepo

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
@@ -862,9 +862,7 @@
 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");
+  const char *options = getenv("TSAN_OPTIONS");
   tsan_flags = new TsanFlags(options);
 
   ompt_set_callback_t ompt_set_callback =
@@ -903,6 +901,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.238291.patch
Type: text/x-patch
Size: 887 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200115/85602ac7/attachment.bin>


More information about the Openmp-commits mailing list