diff options
author | Joachim Protze <protze@itc.rwth-aachen.de> | 2020-01-15 07:07:47 -1000 |
---|---|---|
committer | Hans Wennborg <hans@chromium.org> | 2020-01-17 10:15:17 +0100 |
commit | a10f87d5695bdd4f1e366c82fd2869f0fe1d4cfe (patch) | |
tree | c8a4cd2feb4ea7d4287fffccc6238dd173a41540 | |
parent | afbebff6cd7be7329bda4500dbfacfc94ff8edba (diff) | |
download | bcm5719-llvm-a10f87d5695bdd4f1e366c82fd2869f0fe1d4cfe.tar.gz bcm5719-llvm-a10f87d5695bdd4f1e366c82fd2869f0fe1d4cfe.zip |
[OpenMP][Tool] Fix memory leak and double-allocation
Fix the memory leak pointed out in https://reviews.llvm.org/D70412.
And a second one due to double-allocation.
Reviewed by: Hahnfeld
Differential revision: https://reviews.llvm.org/D72779
(cherry picked from commit 39f746d8def66ef8f5c4d3f1eb4c4cee4baac988)
-rw-r--r-- | openmp/tools/archer/ompt-tsan.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/openmp/tools/archer/ompt-tsan.cpp b/openmp/tools/archer/ompt-tsan.cpp index 50b98e2a485..39512d38e3c 100644 --- a/openmp/tools/archer/ompt-tsan.cpp +++ b/openmp/tools/archer/ompt-tsan.cpp @@ -114,7 +114,6 @@ void __attribute__((weak)) __tsan_flush_memory() {} } #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 void ompt_tsan_mutex_released(ompt_mutex_t kind, 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(options); ompt_set_callback_t ompt_set_callback = (ompt_set_callback_t)lookup("ompt_set_callback"); @@ -898,7 +895,7 @@ static int ompt_tsan_initialize(ompt_function_lookup_t lookup, SET_CALLBACK_T(mutex_released, mutex); SET_OPTIONAL_CALLBACK_T(reduction, sync_region, hasReductionCallback, ompt_set_never); - if (!tsan_flags->ignore_noninstrumented_modules) + if (!tsan_flags.ignore_noninstrumented_modules) fprintf( stderr, "Warning: please export TSAN_OPTIONS='ignore_noninstrumented_modules=1' " |