[td-255] fix counting value error bug.

This commit is contained in:
Haojun Liao 2020-08-10 18:30:16 +08:00
parent dcfab65c6a
commit 98cec99dc1
1 changed files with 3 additions and 0 deletions

View File

@ -451,6 +451,8 @@ int32_t taosHashCondTraverse(SHashObj *pHashObj, bool (*fp)(void *, void *), voi
while((pNode = pEntry->next) != NULL) {
if (fp && (!fp(param, pNode->data))) {
pEntry->num -= 1;
atomic_sub_fetch_64(&pHashObj->size, 1);
pEntry->next = pNode->next;
if (pEntry->num == 0) {
@ -475,6 +477,7 @@ int32_t taosHashCondTraverse(SHashObj *pHashObj, bool (*fp)(void *, void *), voi
if (fp && (!fp(param, pNext->data))) {
pNode->next = pNext->next;
pEntry->num -= 1;
atomic_sub_fetch_64(&pHashObj->size, 1);
if (pEntry->num == 0) {
assert(pEntry->next == NULL);