summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2014-04-23 16:54:52 +0000
committerJordan Rose <jordan_rose@apple.com>2014-04-23 16:54:52 +0000
commite811ab9582e3d7f9a4ed03326a845b374d185b59 (patch)
treeb2e6fc926c7e97e5369d42bcd99d2cf702c6cbea /clang/lib/StaticAnalyzer/Core/BugReporter.cpp
parent6b4bed4b8387755b7eea43642ef5d47e4815ead3 (diff)
downloadbcm5719-llvm-e811ab9582e3d7f9a4ed03326a845b374d185b59.tar.gz
bcm5719-llvm-e811ab9582e3d7f9a4ed03326a845b374d185b59.zip
[analyzer] Fix a leak found by LSan.
PR19524 llvm-svn: 207001
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/BugReporter.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/BugReporter.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
index ea6af07f347..6569141b517 100644
--- a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -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
OpenPOWER on IntegriCloud