From edfe07fca0ae8c4ef749d9fac859b17f7dd23f65 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Thu, 24 Apr 2014 06:05:40 +0000 Subject: [PATCH] Simplify leak fix of r207076, by just disposing the previous CXString. llvm-svn: 207081 --- clang/tools/libclang/CIndex.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 25f53c4f3d64..f3c9f2fa4446 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/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; }