This commit is contained in:
liuyao 2023-08-24 11:34:43 +08:00
parent 7ebce2814f
commit 1e108c4178
1 changed files with 6 additions and 2 deletions

View File

@ -1613,6 +1613,9 @@ int32_t streamStateSessionGetKVByCur_rocksdb(SStreamStateCur* pCur, SSessionKey*
const char* curKey = rocksdb_iter_key(pCur->iter, (size_t*)&kLen);
stateSessionKeyDecode((void*)&ktmp, (char*)curKey);
if (pVal != NULL) *pVal = NULL;
if (pVLen != NULL) *pVLen = 0;
SStateSessionKey* pKTmp = &ktmp;
const char* vval = rocksdb_iter_value(pCur->iter, (size_t*)&vLen);
char* val = NULL;
@ -1621,8 +1624,6 @@ int32_t streamStateSessionGetKVByCur_rocksdb(SStreamStateCur* pCur, SSessionKey*
return -1;
}
if (pVLen != NULL) *pVLen = len;
if (pKTmp->opNum != pCur->number) {
taosMemoryFree(val);
return -1;
@ -1631,11 +1632,14 @@ int32_t streamStateSessionGetKVByCur_rocksdb(SStreamStateCur* pCur, SSessionKey*
taosMemoryFree(val);
return -1;
}
if (pVal != NULL) {
*pVal = (char*)val;
} else {
taosMemoryFree(val);
}
if (pVLen != NULL) *pVLen = len;
*pKey = pKTmp->key;
return 0;
}