r207077 - Don't leak invalid RegexDirectives. Probably a small part of PR19520.
Nico Weber
nicolasweber at gmx.de
Wed Apr 23 22:32:03 PDT 2014
Author: nico
Date: Thu Apr 24 00:32:03 2014
New Revision: 207077
URL: http://llvm.org/viewvc/llvm-project?rev=207077&view=rev
Log:
Don't leak invalid RegexDirectives. Probably a small part of PR19520.
Modified:
cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp
Modified: cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp?rev=207077&r1=207076&r2=207077&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp (original)
+++ cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp Thu Apr 24 00:32:03 2014
@@ -491,11 +491,12 @@ static bool ParseDirective(StringRef S,
}
// Construct new directive.
- Directive *D = Directive::create(RegexKind, Pos, ExpectedLoc, Text,
- Min, Max);
+ std::unique_ptr<Directive> D(
+ Directive::create(RegexKind, Pos, ExpectedLoc, Text, Min, Max));
+
std::string Error;
if (D->isValid(Error)) {
- DL->push_back(D);
+ DL->push_back(D.release());
FoundDirective = true;
} else {
Diags.Report(Pos.getLocWithOffset(ContentBegin-PH.Begin),
@@ -880,5 +881,6 @@ Directive *Directive::create(bool RegexK
}
}
- return new RegexDirective(DirectiveLoc, DiagnosticLoc, Text, Min, Max, RegexStr);
+ return new RegexDirective(DirectiveLoc, DiagnosticLoc, Text, Min, Max,
+ RegexStr);
}
More information about the cfe-commits
mailing list