[CP] add error code when alloc memory failed

This commit is contained in:
obdev
2023-07-11 18:48:08 +00:00
committed by ob-robot
parent e354f149d2
commit e269245733
12 changed files with 21 additions and 2 deletions

View File

@ -54,6 +54,8 @@ int ObUdfCtxMgr::register_udf_expr(const ObExprDllUdf *expr, const ObNormalUdfFu
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("allocate memory failed", K(ret));
} else if (OB_ISNULL(tmp_udf_exec_unit = (ObNormalUdfExeUnit *)allocator_.alloc(sizeof(ObNormalUdfExeUnit)))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("allocate memory failed", K(ret), K(sizeof(ObNormalUdfExeUnit)));
} else {
new_udf_ctx->state_ = ObUdfFunction::UDF_UNINITIALIZED;
IGNORE_RETURN ObUdfUtil::construct_udf_args(new_udf_ctx->udf_args_);

View File

@ -327,8 +327,12 @@ int ObUdfUtil::init_udf_args(ObIAllocator &allocator,
if (OB_FAIL(convert_ob_type_to_udf_type(udf_attributes_types.at(i).get_type(), udf_args.arg_type[i]))) {
LOG_WARN("failt to convert ob type to udf type", K(udf_attributes_types.at(i).get_type()), K(udf_attributes_types.at(i).get_calc_type()));
} else if (udf_args.attribute_lengths[i] > 0) {
udf_args.attributes[i] = (char*)allocator.alloc(udf_args.attribute_lengths[i]);
IGNORE_RETURN MEMCPY(udf_args.attributes[i], udf_attributes.at(i).ptr(), udf_attributes.at(i).length());
if (OB_ISNULL(udf_args.attributes[i] = (char*)allocator.alloc(udf_args.attribute_lengths[i]))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("failed to allocate memory", K(ret), K(udf_args.attribute_lengths[i]));
} else {
IGNORE_RETURN MEMCPY(udf_args.attributes[i], udf_attributes.at(i).ptr(), udf_attributes.at(i).length());
}
} else {
udf_args.attributes[i] = nullptr;
}