[PATCH] D24659: Trying to fix Mangler memory leak in TargetLoweringObjectFile.
Eric Liu via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 16 04:59:29 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL281718: Trying to fix Mangler memory leak in TargetLoweringObjectFile. (authored by ioeric).
Changed prior to commit:
https://reviews.llvm.org/D24659?vs=71616&id=71617#toc
Repository:
rL LLVM
https://reviews.llvm.org/D24659
Files:
llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
Index: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
===================================================================
--- llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
+++ llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
@@ -38,7 +38,7 @@
MCContext *Ctx;
/// Name-mangler for global names.
- Mangler *Mang;
+ Mangler *Mang = nullptr;
TargetLoweringObjectFile(
const TargetLoweringObjectFile&) = delete;
Index: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
===================================================================
--- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
+++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
@@ -43,6 +43,8 @@
void TargetLoweringObjectFile::Initialize(MCContext &ctx,
const TargetMachine &TM) {
Ctx = &ctx;
+ // `Initialize` can be called more than once.
+ if (Mang != nullptr) delete Mang;
Mang = new Mangler();
InitMCObjectFileInfo(TM.getTargetTriple(), TM.isPositionIndependent(),
TM.getCodeModel(), *Ctx);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24659.71617.patch
Type: text/x-patch
Size: 1092 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160916/e2f8c8e2/attachment.bin>
More information about the llvm-commits
mailing list