From a4c120ee28c070aa46017e2cb6610ace3b6afbb2 Mon Sep 17 00:00:00 2001 From: sima Date: Tue, 6 Aug 2024 17:58:38 +0800 Subject: [PATCH 1/2] fix:[TD-31276] check malloc result. --- source/libs/scalar/inc/filterInt.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/libs/scalar/inc/filterInt.h b/source/libs/scalar/inc/filterInt.h index ab04f06b02..1d7472e15d 100644 --- a/source/libs/scalar/inc/filterInt.h +++ b/source/libs/scalar/inc/filterInt.h @@ -481,6 +481,9 @@ struct SFilterInfo { #define FILTER_COPY_IDX(dst, src, n) \ do { \ *(dst) = taosMemoryMalloc(sizeof(uint32_t) * n); \ + if (NULL == *(dst)) { \ + FLT_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); \ + } \ (void)memcpy(*(dst), src, sizeof(uint32_t) * n); \ } while (0) From e8a6e15c490dd09173f97fbade651432c38f3fea Mon Sep 17 00:00:00 2001 From: dapan1121 <72057773+dapan1121@users.noreply.github.com> Date: Wed, 7 Aug 2024 16:10:27 +0800 Subject: [PATCH 2/2] Update filterInt.h --- source/libs/scalar/inc/filterInt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/scalar/inc/filterInt.h b/source/libs/scalar/inc/filterInt.h index 1d7472e15d..4d45fb344c 100644 --- a/source/libs/scalar/inc/filterInt.h +++ b/source/libs/scalar/inc/filterInt.h @@ -464,7 +464,7 @@ struct SFilterInfo { (colInfo).type = RANGE_TYPE_UNIT; \ (colInfo).dataType = FILTER_UNIT_DATA_TYPE(u); \ if (taosArrayPush((SArray *)((colInfo).info), &u) == NULL) { \ - FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); \ + FLT_ERR_RET(terrno); \ } \ } while (0) #define FILTER_PUSH_VAR_HASH(colInfo, ha) \ @@ -482,7 +482,7 @@ struct SFilterInfo { do { \ *(dst) = taosMemoryMalloc(sizeof(uint32_t) * n); \ if (NULL == *(dst)) { \ - FLT_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); \ + FLT_ERR_JRET(terrno); \ } \ (void)memcpy(*(dst), src, sizeof(uint32_t) * n); \ } while (0)