Author: arphaman Date: Tue Jan 8 15:28:37 2019 New Revision: 350680 URL: http://llvm.org/viewvc/llvm-project?rev=350680&view=rev Log: [libclang] Fix the mismatched delete operator for ExprEvalResult
The '.stringVal' field in ExprEvalResult is allocated using new[], but was freed using a regular delete. That caused memory leaks in the test from r350666. Modified: cfe/trunk/tools/libclang/CIndex.cpp Modified: cfe/trunk/tools/libclang/CIndex.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=350680&r1=350679&r2=350680&view=diff ============================================================================== --- cfe/trunk/tools/libclang/CIndex.cpp (original) +++ cfe/trunk/tools/libclang/CIndex.cpp Tue Jan 8 15:28:37 2019 @@ -3694,7 +3694,7 @@ struct ExprEvalResult { ~ExprEvalResult() { if (EvalType != CXEval_UnExposed && EvalType != CXEval_Float && EvalType != CXEval_Int) { - delete EvalData.stringVal; + delete[] EvalData.stringVal; } } }; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits