From 76cb9ba4a4ecc88a336c3bd0814cb7964a3e52a2 Mon Sep 17 00:00:00 2001 From: qingzhu521 Date: Thu, 11 Apr 2024 13:15:14 +0000 Subject: [PATCH] fix the error code of alloc mem failed --- src/sql/engine/expr/ob_expr_frame_info.cpp | 5 ++++- src/sql/engine/ob_exec_context.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/sql/engine/expr/ob_expr_frame_info.cpp b/src/sql/engine/expr/ob_expr_frame_info.cpp index 1e0fae94ca..ab35252944 100644 --- a/src/sql/engine/expr/ob_expr_frame_info.cpp +++ b/src/sql/engine/expr/ob_expr_frame_info.cpp @@ -712,7 +712,10 @@ int ObTempExpr::deep_copy(ObIAllocator &allocator, ObTempExpr *&dst) const { int ret = OB_SUCCESS; char *buf = static_cast(allocator.alloc(sizeof(ObTempExpr))); - CK(OB_NOT_NULL(buf)); + if (OB_ISNULL(buf)) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("fail to alloc mem in temp expr deep copy", K(ret)); + } OX(dst = new(buf)ObTempExpr(allocator)); OZ(dst->assign(*this, allocator)); OX(dst->expr_idx_ = expr_idx_); diff --git a/src/sql/engine/ob_exec_context.cpp b/src/sql/engine/ob_exec_context.cpp index 329c5ca3f9..6f1132d2b4 100644 --- a/src/sql/engine/ob_exec_context.cpp +++ b/src/sql/engine/ob_exec_context.cpp @@ -343,7 +343,10 @@ int ObExecContext::build_temp_expr_ctx(const ObTempExpr &temp_expr, ObTempExprCt char **frames = NULL; char *mem = static_cast(get_allocator().alloc(sizeof(ObTempExprCtx))); ObArray tmp_param_frame_ptrs; - CK(OB_NOT_NULL(mem)); + if (OB_ISNULL(mem)) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("no more memory to create temp expr ctx", K(ret)); + } OX(temp_expr_ctx = new(mem)ObTempExprCtx(*this)); OZ(temp_expr.alloc_frame(get_allocator(), tmp_param_frame_ptrs, frame_cnt, frames)); OX(temp_expr_ctx->frames_ = frames);