trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbirds...@apache.org
Subject [3/4] trafodion git commit: [TRAFODION-2772] - retrieve a value from Json string got an error: using array to replace dynamic memory
Date Wed, 07 Feb 2018 17:30:47 GMT
[TRAFODION-2772] - retrieve a value from Json string got an error: using array to replace dynamic
memory


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

Branch: refs/heads/master
Commit: f8726b4d7efc6d9ca9115ce8e4ffbc69815c3b57
Parents: f9888bc
Author: Andy Yang <yongfeng.yang@esgyn.cn>
Authored: Wed Feb 7 15:55:32 2018 +0800
Committer: Andy Yang <yongfeng.yang@esgyn.cn>
Committed: Wed Feb 7 15:55:32 2018 +0800

----------------------------------------------------------------------
 core/sql/exp/exp_function.cpp | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/f8726b4d/core/sql/exp/exp_function.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_function.cpp b/core/sql/exp/exp_function.cpp
index b802289..13815a3 100644
--- a/core/sql/exp/exp_function.cpp
+++ b/core/sql/exp/exp_function.cpp
@@ -6505,8 +6505,8 @@ ex_expr::exp_return_type ex_function_json_object_field_text::eval(char
*op_data[
     }
 
     char *rltStr = NULL;
-    char *jsonStr = new(heap) char[len1+1];
-    char *jsonAttr = new(heap) char[len2+1];
+    char jsonStr[len1+1];
+    char jsonAttr[len2+1];
     strncpy(jsonStr, op_data[1], len1);
     jsonStr[len1] = '\0';
     strncpy(jsonAttr, op_data[2], len2);
@@ -6514,10 +6514,6 @@ 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;
     }
@@ -6535,11 +6531,6 @@ 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;
 }
 


Mime
View raw message