Skip to content

Commit eb750a6

Browse files
committed
Fix possible memory leak
1 parent 54f9cae commit eb750a6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/IRGen/IRGen.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,9 +1205,10 @@ swift::irgen::createIRGenModule(SILModule *SILMod, StringRef OutputFilename,
12051205
IRGenOptions &Opts) {
12061206
IRGenerator *irgen = new IRGenerator(Opts, *SILMod);
12071207
auto targetMachine = irgen->createTargetMachine();
1208-
if (!targetMachine)
1208+
if (!targetMachine) {
1209+
delete irgen;
12091210
return std::make_pair(nullptr, nullptr);
1210-
1211+
}
12111212
// Create the IR emitter.
12121213
IRGenModule *IGM = new IRGenModule(
12131214
*irgen, std::move(targetMachine), nullptr, "", OutputFilename,

0 commit comments

Comments
 (0)