[CP] [to #46475366] fix memory leak of udf`s collection result

This commit is contained in:
obdev 2022-12-27 06:38:05 +00:00 committed by ob-robot
parent 5aed6bd3d8
commit c064eb597c

View File

@ -514,10 +514,13 @@ int ObExprUDF::eval_udf(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res)
} else if (info->is_called_in_sql_) {
if (tmp_result.is_pl_extend()) {
OZ (pl::ObUserDefinedType::deep_copy_obj(alloc, tmp_result, result, true));
OZ (pl::ObUserDefinedType::destruct_obj(tmp_result, ctx.exec_ctx_.get_my_session()));
CK (OB_NOT_NULL(ctx.exec_ctx_.get_pl_ctx()));
OX (ctx.exec_ctx_.get_pl_ctx()->reset_obj());
OZ (ctx.exec_ctx_.get_pl_ctx()->add(result));
} else {
OZ (deep_copy_obj(alloc, tmp_result, result));
}
OX (ctx.exec_ctx_.get_pl_ctx()->reset_obj());
} else {
result = tmp_result;
}