trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From selvaganesang <...@git.apache.org>
Subject [GitHub] trafodion pull request #1264: [TRAFODION-2772] - retrieve a value from Json ...
Date Mon, 05 Feb 2018 18:29:45 GMT
Github user selvaganesang commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1264#discussion_r166066307
  
    --- Diff: core/sql/exp/exp_function.cpp ---
    @@ -6503,8 +6503,19 @@ ex_expr::exp_return_type ex_function_json_object_field_text::eval(char
*op_data[
             Int32 prec2 = ((SimpleType *)getOperand(2))->getPrecision();
             len2 = Attributes::trimFillerSpaces( op_data[2], prec2, len2, cs );
         }
    +
         char *rltStr = NULL;
    -    JsonReturnType ret = json_extract_path_text(&rltStr, op_data[1], 1, op_data[2]);
    +    char *jsonStr = new(heap) char[len1+1];
    +    char *jsonAttr = new(heap) char[len2+1];
    +    if (jsonStr == NULL || jsonAttr == NULL)
    +    {
    +        return ex_expr::EXPR_ERROR;
    +    }
    +    memset(jsonStr, 0, len1+1);
    +    memset(jsonAttr, 0, len2+1);
    --- End diff --
    
    Yes. No need to do memset.


---

Mime
View raw message