Merge pull request #27214 from taosdata/fix/3.0/TD-31439

fix:[TD-31439] Reset groupNum and unitNum when malloc failed.
This commit is contained in:
dapan1121 2024-08-14 17:07:34 +08:00 committed by GitHub
commit e72cf17985
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -2776,6 +2776,7 @@ int32_t filterConvertGroupFromArray(SFilterInfo *info, SArray *group) {
if (info->groupNum > 0) { if (info->groupNum > 0) {
info->groups = taosMemoryCalloc(info->groupNum, sizeof(*info->groups)); info->groups = taosMemoryCalloc(info->groupNum, sizeof(*info->groups));
if (info->groups == NULL) { if (info->groups == NULL) {
info->groupNum = 0;
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
} }
} }
@ -2787,6 +2788,7 @@ int32_t filterConvertGroupFromArray(SFilterInfo *info, SArray *group) {
} }
pg->unitFlags = taosMemoryCalloc(pg->unitNum, sizeof(*pg->unitFlags)); pg->unitFlags = taosMemoryCalloc(pg->unitNum, sizeof(*pg->unitFlags));
if (pg->unitFlags == NULL) { if (pg->unitFlags == NULL) {
pg->unitNum = 0;
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
} }
info->groups[i] = *pg; info->groups[i] = *pg;