]> granicus.if.org Git - clang/commitdiff
[libclang] Fix the mismatched delete operator for ExprEvalResult
authorAlex Lorenz <arphaman@gmail.com>
Tue, 8 Jan 2019 23:28:37 +0000 (23:28 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Tue, 8 Jan 2019 23:28:37 +0000 (23:28 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350680 91177308-0d34-0410-b5e6-96231b3b80d8

tools/libclang/CIndex.cpp

index 15b2df84935e4052e7aa4d39f3e9064246efcc46..a9c3077e5fa20ab5f2275bf4a65e72883f5131a8 100644 (file)
@@ -3694,7 +3694,7 @@ struct ExprEvalResult {
   ~ExprEvalResult() {
     if (EvalType != CXEval_UnExposed && EvalType != CXEval_Float &&
         EvalType != CXEval_Int) {
-      delete EvalData.stringVal;
+      delete[] EvalData.stringVal;
     }
   }
 };