[lld] r299509 - Fix memory leak found by asan.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 4 20:52:47 PDT 2017
Author: ruiu
Date: Tue Apr 4 22:52:47 2017
New Revision: 299509
URL: http://llvm.org/viewvc/llvm-project?rev=299509&view=rev
Log:
Fix memory leak found by asan.
Modified:
lld/trunk/ELF/LinkerScript.cpp
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=299509&r1=299508&r2=299509&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Tue Apr 4 22:52:47 2017
@@ -1168,7 +1168,7 @@ void ScriptParser::readLinkerScript() {
} else if (Tok == "VERSION") {
readVersion();
} else if (SymbolAssignment *Cmd = readProvideOrAssignment(Tok)) {
- Script->Opt.Commands.emplace_back(Cmd);
+ Script->Opt.Commands.push_back(Cmd);
} else {
setError("unknown directive: " + Tok);
}
@@ -1530,11 +1530,11 @@ ScriptParser::readOutputSectionDescripti
if (Tok == ";") {
// Empty commands are allowed. Do nothing here.
} else if (SymbolAssignment *Assignment = readProvideOrAssignment(Tok)) {
- Cmd->Commands.emplace_back(Assignment);
+ Cmd->Commands.push_back(Assignment);
} else if (BytesDataCommand *Data = readBytesDataCommand(Tok)) {
- Cmd->Commands.emplace_back(Data);
+ Cmd->Commands.push_back(Data);
} else if (Tok == "ASSERT") {
- Cmd->Commands.emplace_back(new AssertCommand(readAssert()));
+ Cmd->Commands.push_back(make<AssertCommand>(readAssert()));
expect(";");
} else if (Tok == "CONSTRUCTORS") {
// CONSTRUCTORS is a keyword to make the linker recognize C++ ctors/dtors
@@ -1545,7 +1545,7 @@ ScriptParser::readOutputSectionDescripti
} else if (Tok == "SORT") {
readSort();
} else if (peek() == "(") {
- Cmd->Commands.emplace_back(readInputSectionDescription(Tok));
+ Cmd->Commands.push_back(readInputSectionDescription(Tok));
} else {
setError("unknown command " + Tok);
}
More information about the llvm-commits
mailing list