diff options
| author | Rui Ueyama <ruiu@google.com> | 2017-04-05 03:52:47 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2017-04-05 03:52:47 +0000 |
| commit | 01aacc94b9960b827cc543c17ed09e5245db5f33 (patch) | |
| tree | 1ed56193a6b5ee06829e682d7047f0b2ec3b3b3d /lld/ELF/LinkerScript.cpp | |
| parent | 4e1e88e300124f9b261f6b752cc13db03573caa1 (diff) | |
| download | bcm5719-llvm-01aacc94b9960b827cc543c17ed09e5245db5f33.tar.gz bcm5719-llvm-01aacc94b9960b827cc543c17ed09e5245db5f33.zip | |
Fix memory leak found by asan.
llvm-svn: 299509
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
| -rw-r--r-- | lld/ELF/LinkerScript.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 9d2ecb7069b..e2483a995fa 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -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::readOutputSectionDescription(StringRef OutSec) { 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::readOutputSectionDescription(StringRef OutSec) { } 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); } |

