From line 693 in file llc.cpp, it uses new operator to creates a ModulePass
and assigned to MMIWP. If the condition after take the true branch, it has
chance to go in to line 702 or line 709, the function will return without
cleaning the memory.
The second issue existed for the same reason, the ref TPC get the pointer
created from LLVMTM.createPassConfig, and will leak memory if goes into
line 709.
This patch uses delete in the issued branch.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/tools/llc/llc.cpp | ||
---|---|---|
702 | Why is it only a leak on these paths? The are other return 1 in this function. Can we use std::unique_ptr where these are created? |
llvm/tools/llc/llc.cpp | ||
---|---|---|
702 |
|
llvm/tools/llc/llc.cpp | ||
---|---|---|
702 | Can we release the unique_ptr when we hand it over to PM? |
llvm/tools/llc/llc.cpp | ||
---|---|---|
702 | Yes we can. If it its preferred, will take a try. |
llvm/tools/llc/llc.cpp | ||
---|---|---|
702 | I took a try and find if we use unique_ptr instead and release the unique_ptr when we hand it over to PM, we can not handle it well after PM.add(MMIWP), at line 734 and 737 we still use it. |
Why is it only a leak on these paths? The are other return 1 in this function.
Can we use std::unique_ptr where these are created?