Merge pull request #2602 from taosdata/feature/2.0tsdb

fix invalid read
This commit is contained in:
Shengliang Guan 2020-07-08 21:57:35 +08:00 committed by GitHub
commit 76198a9f1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -498,7 +498,17 @@ void tSkipListRemoveNode(SSkipList *pSkipList, SSkipListNode *pNode) {
if (pSkipList->lock) {
pthread_rwlock_wrlock(pSkipList->lock);
}
if (pSkipList->size == 1) {
assert(pSkipList->lastKey == SL_GET_NODE_KEY(pSkipList, pNode));
pSkipList->lastKey = 0;
} else {
if (pSkipList->lastKey == SL_GET_NODE_KEY(pSkipList, pNode)) {
SSkipListNode* prev = SL_GET_BACKWARD_POINTER(pNode, 0);
pSkipList->lastKey = SL_GET_NODE_KEY(pSkipList, prev);
}
}
for (int32_t j = level - 1; j >= 0; --j) {
SSkipListNode* prev = SL_GET_BACKWARD_POINTER(pNode, j);
SSkipListNode* next = SL_GET_FORWARD_POINTER(pNode, j);