[xml] fix ObPathVarObject mem leak
This commit is contained in:
@ -98,7 +98,7 @@ int ObExprExtractValue::eval_extract_value(const ObExpr &expr, ObEvalCtx &ctx, O
|
||||
ObIMulModeBase *xml_doc = NULL;
|
||||
ObPathExprIter xpath_iter(&allocator);
|
||||
ObString default_ns;
|
||||
ObPathVarObject *prefix_ns = NULL;
|
||||
ObPathVarObject prefix_ns(allocator);
|
||||
ObNodeMemType expect_type = ObNodeMemType::BINARY_TYPE;
|
||||
ObString xml_res;
|
||||
ObCollationType cs_type = CS_TYPE_INVALID;
|
||||
@ -132,7 +132,7 @@ int ObExprExtractValue::eval_extract_value(const ObExpr &expr, ObEvalCtx &ctx, O
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_FAIL(ObXMLExprHelper::get_xml_base(xml_mem_ctx, xml_datum, cs_type, expect_type, xml_doc))) {
|
||||
LOG_WARN("fail to parse xml doc", K(ret));
|
||||
} else if (OB_FAIL(extract_xpath_result(xml_mem_ctx, xpath_str, default_ns, xml_doc, prefix_ns, xml_res))) {
|
||||
} else if (OB_FAIL(extract_xpath_result(xml_mem_ctx, xpath_str, default_ns, xml_doc, &prefix_ns, xml_res))) {
|
||||
LOG_WARN("fail to extract xpath result", K(ret), K(xpath_str));
|
||||
} else if (xml_res.empty()) {
|
||||
res.set_null();
|
||||
|
||||
@ -92,7 +92,7 @@ int ObExprExtractXml::eval_extract_xml(const ObExpr &expr, ObEvalCtx &ctx, ObDat
|
||||
ObIMulModeBase *xml_doc = NULL;
|
||||
ObPathExprIter xpath_iter(&allocator);
|
||||
ObString default_ns;
|
||||
ObPathVarObject *prefix_ns = NULL;
|
||||
ObPathVarObject prefix_ns(allocator);
|
||||
ObString xml_res;
|
||||
ObXmlDocument *root = nullptr;
|
||||
ObMulModeNodeType node_type = M_MAX_TYPE;
|
||||
@ -128,7 +128,7 @@ int ObExprExtractXml::eval_extract_xml(const ObExpr &expr, ObEvalCtx &ctx, ObDat
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_FAIL(ObXMLExprHelper::get_xml_base(mem_ctx, xml_datum, cs_type, expect_type, xml_doc))) {
|
||||
LOG_WARN("fail to parse xml doc", K(ret));
|
||||
} else if (OB_FAIL(xpath_iter.init(mem_ctx, xpath_str, default_ns, xml_doc, prefix_ns))) {
|
||||
} else if (OB_FAIL(xpath_iter.init(mem_ctx, xpath_str, default_ns, xml_doc, &prefix_ns))) {
|
||||
LOG_WARN("fail to init xpath iterator", K(xpath_str), K(default_ns), K(ret));
|
||||
ObXMLExprHelper::replace_xpath_ret_code(ret);
|
||||
} else if (OB_FAIL(concat_xpath_result(xpath_iter, cs_type, root, node_type, mem_ctx))) {
|
||||
|
||||
@ -113,7 +113,7 @@ int ObExprUpdateXml::eval_update_xml(const ObExpr &expr, ObEvalCtx &ctx, ObDatum
|
||||
ObIMulModeBase *xml_tree = NULL;
|
||||
bool has_namespace_str = false;
|
||||
int64_t num_child = expr.arg_cnt_;
|
||||
ObPathVarObject *prefix_ns = NULL;
|
||||
ObPathVarObject prefix_ns(allocator);
|
||||
ObString default_ns;
|
||||
ObCollationType cs_type = CS_TYPE_INVALID;
|
||||
ObMulModeMemCtx* xml_mem_ctx = nullptr;
|
||||
@ -161,8 +161,8 @@ int ObExprUpdateXml::eval_update_xml(const ObExpr &expr, ObEvalCtx &ctx, ObDatum
|
||||
} else if (xpath_str.empty()) {
|
||||
ret = OB_ERR_INVALID_XPATH_EXPRESSION;
|
||||
LOG_WARN("xpath is empty", K(ret));
|
||||
} else if (OB_FAIL(update_xml_tree(xml_mem_ctx, expr.args_[i+1], ctx, xpath_str, default_ns, prefix_ns, xml_tree))) {
|
||||
LOG_WARN("fail to do update in xml tree", K(ret), K(xml_tree), K(xpath_str), K(default_ns), K(prefix_ns), K(i+1));
|
||||
} else if (OB_FAIL(update_xml_tree(xml_mem_ctx, expr.args_[i+1], ctx, xpath_str, default_ns, &prefix_ns, xml_tree))) {
|
||||
LOG_WARN("fail to do update in xml tree", K(ret), K(xml_tree), K(xpath_str), K(default_ns), K(i+1));
|
||||
}
|
||||
}
|
||||
// set result
|
||||
|
||||
Reference in New Issue
Block a user