From db82b0b5cd24fad4da3028a3a501932dd7abfadb Mon Sep 17 00:00:00 2001 From: tushicheng <18829573815@163.com> Date: Tue, 12 Dec 2023 03:40:45 +0000 Subject: [PATCH] [CP] fix core when create_tg_tenant with no_memory --- deps/oblib/src/lib/thread/thread_mgr.cpp | 8 +++++--- src/share/ob_thread_mgr.cpp | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/deps/oblib/src/lib/thread/thread_mgr.cpp b/deps/oblib/src/lib/thread/thread_mgr.cpp index 0f5d0e5710..29e9d70bb9 100644 --- a/deps/oblib/src/lib/thread/thread_mgr.cpp +++ b/deps/oblib/src/lib/thread/thread_mgr.cpp @@ -44,10 +44,12 @@ void __attribute__((weak)) init_create_func() void lib_init_create_func() { - #define TG_DEF(id, name, type, args...) \ + #define TG_DEF(id, name, type, args...) \ create_funcs_[TGDefIDs::id] = []() { \ - auto ret = OB_NEW(TG_##type, SET_USE_500("tg"), args); \ - ret->attr_ = {#name, TGType::type}; \ + TG_##type *ret = OB_NEW(TG_##type, SET_USE_500("tg"), args); \ + if (NULL != ret) { \ + ret->attr_ = {#name, TGType::type}; \ + } \ return ret; \ }; #include "lib/thread/thread_define.h" diff --git a/src/share/ob_thread_mgr.cpp b/src/share/ob_thread_mgr.cpp index 38fca9eadf..f0ff3c2e61 100644 --- a/src/share/ob_thread_mgr.cpp +++ b/src/share/ob_thread_mgr.cpp @@ -35,10 +35,12 @@ namespace share { void ob_init_create_func() { - #define TG_DEF(id, name, type, args...) \ + #define TG_DEF(id, name, type, args...) \ lib::create_funcs_[lib::TGDefIDs::id] = []() { \ - auto ret = OB_NEW(TG_##type, SET_USE_500("tg"), args); \ - ret->attr_ = {#name, TGType::type}; \ + TG_##type *ret = OB_NEW(TG_##type, SET_USE_500("tg"), args); \ + if (NULL != ret) { \ + ret->attr_ = {#name, TGType::type}; \ + } \ return ret; \ }; #include "share/ob_thread_define.h"