You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2018/02/07 17:30:46 UTC

[2/4] trafodion git commit: [TRAFODION-2772] - retrieve a value from Json string got an error: release memory to heap

[TRAFODION-2772] - retrieve a value from Json string got an error: release memory to heap


Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/f9888bc0
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/f9888bc0
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/f9888bc0

Branch: refs/heads/master
Commit: f9888bc0b2ec65af99f757d3b2d1299c57734e1a
Parents: b2984e1
Author: Andy Yang <yo...@esgyn.cn>
Authored: Tue Feb 6 18:13:31 2018 +0800
Committer: Andy Yang <yo...@esgyn.cn>
Committed: Tue Feb 6 18:13:31 2018 +0800

----------------------------------------------------------------------
 core/sql/exp/exp_function.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/f9888bc0/core/sql/exp/exp_function.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_function.cpp b/core/sql/exp/exp_function.cpp
index c439559..b802289 100644
--- a/core/sql/exp/exp_function.cpp
+++ b/core/sql/exp/exp_function.cpp
@@ -6514,6 +6514,10 @@ ex_expr::exp_return_type ex_function_json_object_field_text::eval(char *op_data[
     JsonReturnType ret = json_extract_path_text(&rltStr, jsonStr, 1, jsonAttr);
     if (ret != JSON_OK)
     {
+        if (jsonStr)
+            NADELETEBASIC(jsonStr,(heap));
+        if (jsonAttr)
+            NADELETEBASIC(jsonAttr,(heap));
         ExRaiseJSONError(heap, diagsArea, ret);
         return ex_expr::EXPR_ERROR;
     }
@@ -6531,6 +6535,11 @@ ex_expr::exp_return_type ex_function_json_object_field_text::eval(char *op_data[
     else
         getOperand(0)->setVarLength(0, op_data[-MAX_OPERANDS]);
 
+    if (jsonStr)
+        NADELETEBASIC(jsonStr,(heap));
+    if (jsonAttr)
+        NADELETEBASIC(jsonAttr,(heap));
+
     return ex_expr::EXPR_OK;
 }