From: Argyrios Kyrtzidis Date: Thu, 24 Apr 2014 06:05:40 +0000 (+0000) Subject: Simplify leak fix of r207076, by just disposing the previous CXString. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9b7ce5b7bd7f45efc4abf36c6456742d2fc8ec5b;p=clang Simplify leak fix of r207076, by just disposing the previous CXString. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207081 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 25f53c4f3d..f3c9f2fa44 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -6027,9 +6027,6 @@ static int getCursorPlatformAvailabilityForDecl(const Decl *D, CXPlatformAvailability *availability, int availability_size) { bool HadAvailAttr = false; - bool DidSetDeprecatedMessage = false; - bool DidSetUnavailableMessage = false; - int N = 0; for (auto A : D->attrs()) { if (DeprecatedAttr *Deprecated = dyn_cast(A)) { @@ -6037,10 +6034,8 @@ static int getCursorPlatformAvailabilityForDecl(const Decl *D, if (always_deprecated) *always_deprecated = 1; if (deprecated_message) { - if (DidSetDeprecatedMessage) - clang_disposeString(*deprecated_message); + clang_disposeString(*deprecated_message); *deprecated_message = cxstring::createDup(Deprecated->getMessage()); - DidSetDeprecatedMessage = true; } continue; } @@ -6050,10 +6045,8 @@ static int getCursorPlatformAvailabilityForDecl(const Decl *D, if (always_unavailable) *always_unavailable = 1; if (unavailable_message) { - if (DidSetUnavailableMessage) - clang_disposeString(*unavailable_message); + clang_disposeString(*unavailable_message); *unavailable_message = cxstring::createDup(Unavailable->getMessage()); - DidSetUnavailableMessage = true; } continue; }