diff options
| author | Ted Kremenek <kremenek@apple.com> | 2012-02-14 06:54:46 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2012-02-14 06:54:46 +0000 |
| commit | b05119cb00487672fcde5511a193d416b17a3e2d (patch) | |
| tree | c96969908f7fa0e2244214d7052fa417c12c4714 | |
| parent | 29d6ed6416a19671c342696035caeb465ff3a0b9 (diff) | |
| download | bcm5719-llvm-b05119cb00487672fcde5511a193d416b17a3e2d.tar.gz bcm5719-llvm-b05119cb00487672fcde5511a193d416b17a3e2d.zip | |
Fix use-after-free introduced by me being an idiot.
llvm-svn: 150461
| -rw-r--r-- | clang/tools/libclang/CIndexDiagnostic.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/clang/tools/libclang/CIndexDiagnostic.cpp b/clang/tools/libclang/CIndexDiagnostic.cpp index a36ca8c5d3c..6a2a2b19041 100644 --- a/clang/tools/libclang/CIndexDiagnostic.cpp +++ b/clang/tools/libclang/CIndexDiagnostic.cpp @@ -44,16 +44,14 @@ CXDiagnosticImpl::~CXDiagnosticImpl() {} namespace { class CXDiagnosticCustomNoteImpl : public CXDiagnosticImpl { - CXString Message; + std::string Message; CXSourceLocation Loc; public: CXDiagnosticCustomNoteImpl(StringRef Msg, CXSourceLocation L) : CXDiagnosticImpl(CustomNoteDiagnosticKind), - Message(createCXString(Msg)), Loc(L) {} + Message(Msg), Loc(L) {} - virtual ~CXDiagnosticCustomNoteImpl() { - clang_disposeString(Message); - } + virtual ~CXDiagnosticCustomNoteImpl() {} CXDiagnosticSeverity getSeverity() const { return CXDiagnostic_Note; @@ -64,7 +62,7 @@ public: } CXString getSpelling() const { - return Message; + return createCXString(StringRef(Message), false); } CXString getDiagnosticOption(CXString *Disable) const { |

