[PATCH] D108251: [llvm-profgen] Use shared pointer to fix memory leak issue from asan
Lei Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 17 15:41:10 PDT 2021
wlei added inline comments.
================
Comment at: llvm/tools/llvm-profgen/PerfReader.cpp:299
// Call to load the binary in the ctor of ProfiledBinary.
- Binary = new ProfiledBinary(BinaryPath);
+ Binary = std::make_shared<ProfiledBinary>(BinaryPath);
// Initialize the base address to preferred address.
----------------
hoy wrote:
> I think you can use `unique_ptr` here. Everywhere else consuming the binary can use the raw pointer, until `PerfReaderBase` is deleted.
Yeah, just realized this, thanks!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108251/new/
https://reviews.llvm.org/D108251
More information about the llvm-commits
mailing list