Skip to content

Commit 3002fee

Browse files
committed
Fix memory leak
1 parent 3d36113 commit 3002fee

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/DependencyScan/ScanDependencies.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,12 +1094,16 @@ forEachBatchEntry(CompilerInstance &invocationInstance,
10941094
if (subInvoke.parseArgs(args, diags)) {
10951095
invocationInstance.getDiags().diagnose(
10961096
SourceLoc(), diag::scanner_arguments_invalid, entry.arguments);
1097+
if (localSubInstanceMap)
1098+
delete subInstanceMap;
10971099
return true;
10981100
}
10991101
std::string InstanceSetupError;
11001102
if (newInstance->setup(subInvoke, InstanceSetupError)) {
11011103
invocationInstance.getDiags().diagnose(
11021104
SourceLoc(), diag::scanner_arguments_invalid, entry.arguments);
1105+
if (localSubInstanceMap)
1106+
delete subInstanceMap;
11031107
return true;
11041108
}
11051109
auto mainModuleName = newInstance->getMainModule()->getNameStr();

0 commit comments

Comments
 (0)