fix asan stack-scope-after-use errror

This commit is contained in:
Ganlin Zhao 2022-12-08 10:57:21 +08:00
parent de4571fbf7
commit ad69067a01
1 changed files with 8 additions and 6 deletions

View File

@ -367,16 +367,18 @@ int32_t tMemBucketPut(tMemBucket *pBucket, const void *data, size_t size) {
pSlot->info.data = NULL; pSlot->info.data = NULL;
} }
SArray **pPageIdList = taosHashGet(pBucket->groupPagesMap, &groupId, sizeof(groupId)); SArray *pPageIdList;
if (pPageIdList == NULL) { void *p = taosHashGet(pBucket->groupPagesMap, &groupId, sizeof(groupId));
SArray *pList = taosArrayInit(4, sizeof(int32_t)); if (p == NULL) {
taosHashPut(pBucket->groupPagesMap, &groupId, sizeof(groupId), &pList, POINTER_BYTES); pPageIdList = taosArrayInit(4, sizeof(int32_t));
pPageIdList = &pList; taosHashPut(pBucket->groupPagesMap, &groupId, sizeof(groupId), &pPageIdList, POINTER_BYTES);
} else {
pPageIdList = *(SArray **)p;
} }
pSlot->info.data = getNewBufPage(pBucket->pBuffer, &pageId); pSlot->info.data = getNewBufPage(pBucket->pBuffer, &pageId);
pSlot->info.pageId = pageId; pSlot->info.pageId = pageId;
taosArrayPush(*pPageIdList, &pageId); taosArrayPush(pPageIdList, &pageId);
} }
memcpy(pSlot->info.data->data + pSlot->info.data->num * pBucket->bytes, d, pBucket->bytes); memcpy(pSlot->info.data->data + pSlot->info.data->num * pBucket->bytes, d, pBucket->bytes);