]> granicus.if.org Git - clang/commitdiff
Simplify leak fix of r207076, by just disposing the previous CXString.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 24 Apr 2014 06:05:40 +0000 (06:05 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 24 Apr 2014 06:05:40 +0000 (06:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207081 91177308-0d34-0410-b5e6-96231b3b80d8

tools/libclang/CIndex.cpp

index 25f53c4f3d64bd073feb8bf8c16b13a40741a329..f3c9f2fa44467ef5e7eef14c7f4e66e6102cb9a1 100644 (file)
@@ -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<DeprecatedAttr>(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;
     }