From 167e58578ad176dc427c7b7cccbb597a5c868310 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Mon, 29 Aug 2022 14:53:13 +0800 Subject: [PATCH] enh: add check for tpagebuf --- source/libs/executor/src/tsimplehash.c | 6 +----- source/util/src/tpagedbuf.c | 1 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/source/libs/executor/src/tsimplehash.c b/source/libs/executor/src/tsimplehash.c index 8cd376e092..84b615af7a 100644 --- a/source/libs/executor/src/tsimplehash.c +++ b/source/libs/executor/src/tsimplehash.c @@ -295,11 +295,7 @@ int32_t tSimpleHashIterateRemove(SSHashObj *pHashObj, const void *key, size_t ke } if (*pIter == (void *)GET_SHASH_NODE_DATA(pNode)) { - if (!pPrev) { - *pIter = NULL; - } else { - *pIter = GET_SHASH_NODE_DATA(pPrev); - } + *pIter = pPrev ? GET_SHASH_NODE_DATA(pPrev) : NULL; } FREE_HASH_NODE(pNode); diff --git a/source/util/src/tpagedbuf.c b/source/util/src/tpagedbuf.c index 4d5532b9a6..0c30cc1003 100644 --- a/source/util/src/tpagedbuf.c +++ b/source/util/src/tpagedbuf.c @@ -465,6 +465,7 @@ void* getBufPage(SDiskbasedBuf* pBuf, int32_t id) { // set the ptr to the new SPageInfo ((void**)((*pi)->pData))[0] = (*pi); + assert(listNEles(pBuf->lruList) < pBuf->inMemPages && pBuf->inMemPages > 0); lruListPushFront(pBuf->lruList, *pi); (*pi)->used = true;