fix: a little bug

This commit is contained in:
Hongze Cheng 2024-07-23 15:40:12 +08:00
parent bf37c4f81b
commit c23ab3023b
1 changed files with 4 additions and 1 deletions

View File

@ -39,6 +39,7 @@ static FORCE_INLINE int32_t getSkipListRandLevel(SSkipList *pSkipList);
SSkipList *tSkipListCreate(uint8_t maxLevel, uint8_t keyType, uint16_t keyLen, __compar_fn_t comparFn, uint8_t flags,
__sl_key_fn_t fn) {
int32_t code = 0;
SSkipList *pSkipList = (SSkipList *)taosMemoryCalloc(1, sizeof(SSkipList));
if (pSkipList == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
@ -67,8 +68,10 @@ SSkipList *tSkipListCreate(uint8_t maxLevel, uint8_t keyType, uint16_t keyLen, _
pSkipList->comparFn = comparFn;
#endif
if (initForwardBackwardPtr(pSkipList) != TSDB_CODE_OUT_OF_MEMORY) {
code = initForwardBackwardPtr(pSkipList);
if (code) {
tSkipListDestroy(pSkipList);
terrno = code;
return NULL;
}