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

Jonas Hahnfeld via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Jan 16 00:35:26 PST 2020


Hahnfeld added inline comments.


================
Comment at: openmp/tools/archer/ompt-tsan.cpp:866
+  const char *options = getenv("TSAN_OPTIONS");
   tsan_flags = new TsanFlags(options);
 
----------------
Hahnfeld wrote:
> Why do we need `tsan_flags` globally? It's again deleted further below, you can just put it onto the stack.
Why do we need to `new` this? Even though not really critical, it'll be leaked in all the error cases below.

It should be easier to do the following:
```
TsanFlags tsan_flags(options);
```


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

https://reviews.llvm.org/D72779





More information about the Openmp-commits mailing list