r201236 - libclang: fix a crash in clang_disposeDiagnosticSet when it is passed a NULL argument
Dmitri Gribenko
gribozavr at gmail.com
Wed Feb 12 06:17:59 PST 2014
Author: gribozavr
Date: Wed Feb 12 08:17:58 2014
New Revision: 201236
URL: http://llvm.org/viewvc/llvm-project?rev=201236&view=rev
Log:
libclang: fix a crash in clang_disposeDiagnosticSet when it is passed a NULL argument
Modified:
cfe/trunk/tools/libclang/CIndexDiagnostic.cpp
Modified: cfe/trunk/tools/libclang/CIndexDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexDiagnostic.cpp?rev=201236&r1=201235&r2=201236&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndexDiagnostic.cpp (original)
+++ cfe/trunk/tools/libclang/CIndexDiagnostic.cpp Wed Feb 12 08:17:58 2014
@@ -450,9 +450,10 @@ CXString clang_getDiagnosticFixIt(CXDiag
}
void clang_disposeDiagnosticSet(CXDiagnosticSet Diags) {
- CXDiagnosticSetImpl *D = static_cast<CXDiagnosticSetImpl*>(Diags);
- if (D->isExternallyManaged())
- delete D;
+ if (CXDiagnosticSetImpl *D = static_cast<CXDiagnosticSetImpl *>(Diags)) {
+ if (D->isExternallyManaged())
+ delete D;
+ }
}
CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags,
More information about the cfe-commits
mailing list