Skip to content

Commit fd2fcbb

Browse files
[WIP] Address review comments - Fix memory leak
1 parent 82665cc commit fd2fcbb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/Driver/ToolChains.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ static void addLTOArgs(const OutputInfo &OI, ArgStringList &arguments) {
143143
}
144144

145145
static void addLinkedLibArgs(const ArgList &Args, ArgStringList &FrontendArgs) {
146-
for(auto Arg:Args.getAllArgValues(options::OPT_l))
147-
{
148-
std::string* lArg = new std::string("-l" + Arg);
149-
FrontendArgs.push_back(lArg->c_str());
146+
Args.getLastArg(options::OPT_l);
147+
for (auto Arg : Args.getAllArgValues(options::OPT_l)) {
148+
const std::string lArg("-l" + Arg);
149+
FrontendArgs.push_back(Args.MakeArgString(Twine(lArg)));
150150
}
151151
}
152152

0 commit comments

Comments
 (0)