forked from OSchip/llvm-project
[analyzer] Fix a leak found by LSan.
PR19524 llvm-svn: 207001
This commit is contained in:
parent
6b4bed4b83
commit
e811ab9582
|
@ -3149,21 +3149,21 @@ bool GRBugReporter::generatePathDiagnostic(PathDiagnostic& PD,
|
|||
|
||||
// Generate the very last diagnostic piece - the piece is visible before
|
||||
// the trace is expanded.
|
||||
PathDiagnosticPiece *LastPiece = 0;
|
||||
std::unique_ptr<PathDiagnosticPiece> LastPiece;
|
||||
for (BugReport::visitor_iterator I = visitors.begin(), E = visitors.end();
|
||||
I != E; ++I) {
|
||||
if (PathDiagnosticPiece *Piece = (*I)->getEndPath(PDB, N, *R)) {
|
||||
assert (!LastPiece &&
|
||||
"There can only be one final piece in a diagnostic.");
|
||||
LastPiece = Piece;
|
||||
LastPiece.reset(Piece);
|
||||
}
|
||||
}
|
||||
|
||||
if (ActiveScheme != PathDiagnosticConsumer::None) {
|
||||
if (!LastPiece)
|
||||
LastPiece = BugReporterVisitor::getDefaultEndPath(PDB, N, *R);
|
||||
LastPiece.reset(BugReporterVisitor::getDefaultEndPath(PDB, N, *R));
|
||||
assert(LastPiece);
|
||||
PD.setEndOfPath(LastPiece);
|
||||
PD.setEndOfPath(LastPiece.release());
|
||||
}
|
||||
|
||||
// Make sure we get a clean location context map so we don't
|
||||
|
|
Loading…
Reference in New Issue