Author: vedantk Date: Sat Apr 2 19:54:46 2016 New Revision: 265252 URL: http://llvm.org/viewvc/llvm-project?rev=265252&view=rev Log: [c-index-test] Fix leak in print_completion_result, NFC
Modified: cfe/trunk/tools/c-index-test/c-index-test.c Modified: cfe/trunk/tools/c-index-test/c-index-test.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=265252&r1=265251&r2=265252&view=diff ============================================================================== --- cfe/trunk/tools/c-index-test/c-index-test.c (original) +++ cfe/trunk/tools/c-index-test/c-index-test.c Sat Apr 2 19:54:46 2016 @@ -1997,6 +1997,7 @@ static void print_completion_result(CXCo enum CXCursorKind ParentKind; CXString ParentName; CXString BriefComment; + CXString Annotation; const char *BriefCommentCString; fprintf(file, "%s:", clang_getCString(ks)); @@ -2030,9 +2031,10 @@ static void print_completion_result(CXCo for (i = 0; i < annotationCount; ++i) { if (i != 0) fprintf(file, ", "); - fprintf(file, "\"%s\"", - clang_getCString(clang_getCompletionAnnotation( - completion_result->CompletionString, i))); + Annotation = + clang_getCompletionAnnotation(completion_result->CompletionString, i); + fprintf(file, "\"%s\"", clang_getCString(Annotation)); + clang_disposeString(Annotation); } fprintf(file, ")"); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits