提交 1f72417e 编写于 作者: H Hongze Cheng

fix invalid read

上级 00112143
......@@ -499,6 +499,16 @@ void tSkipListRemoveNode(SSkipList *pSkipList, SSkipListNode *pNode) {
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册