Skip to content

Commit

Permalink
Merge pull request #22547 from taosdata/fix/TD-25923
Browse files Browse the repository at this point in the history
mem leak
  • Loading branch information
hjxilinx committed Aug 24, 2023
2 parents d25dda4 + 1e108c4 commit 5445e83
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions source/libs/executor/src/filloperator.c
Expand Up @@ -851,6 +851,7 @@ void setFillValueInfo(SSDataBlock* pBlock, TSKEY ts, int32_t rowId, SStreamFillS
if (hasPrevWindow(pFillSup)) {
setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo);
pFillInfo->pos = FILL_POS_END;
resetFillWindow(&pFillSup->next);
pFillSup->next.key = pFillSup->cur.key;
pFillSup->next.pRowVal = pFillSup->cur.pRowVal;
pFillInfo->preRowKey = INT64_MIN;
Expand Down
3 changes: 3 additions & 0 deletions source/libs/executor/src/timewindowoperator.c
Expand Up @@ -2905,6 +2905,7 @@ void destroyStreamSessionAggOperatorInfo(void* param) {
SStreamSessionAggOperatorInfo* pInfo = (SStreamSessionAggOperatorInfo*)param;
cleanupBasicInfo(&pInfo->binfo);
destroyStreamAggSupporter(&pInfo->streamAggSup);
cleanupExprSupp(&pInfo->scalarSupp);

if (pInfo->pChildren != NULL) {
int32_t size = taosArrayGetSize(pInfo->pChildren);
Expand Down Expand Up @@ -4096,6 +4097,7 @@ void destroyStreamStateOperatorInfo(void* param) {
cleanupBasicInfo(&pInfo->binfo);
destroyStreamAggSupporter(&pInfo->streamAggSup);
cleanupGroupResInfo(&pInfo->groupResInfo);
cleanupExprSupp(&pInfo->scalarSupp);
if (pInfo->pChildren != NULL) {
int32_t size = taosArrayGetSize(pInfo->pChildren);
for (int32_t i = 0; i < size; i++) {
Expand All @@ -4109,6 +4111,7 @@ void destroyStreamStateOperatorInfo(void* param) {
taosArrayDestroy(pInfo->historyWins);
tSimpleHashCleanup(pInfo->pSeUpdated);
tSimpleHashCleanup(pInfo->pSeDeleted);
pInfo->pUpdated = taosArrayDestroy(pInfo->pUpdated);
taosMemoryFreeClear(param);
}

Expand Down
19 changes: 13 additions & 6 deletions source/libs/stream/src/streamBackendRocksdb.c
Expand Up @@ -1613,26 +1613,33 @@ 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;
int32_t len = decodeValueFunc((void*)vval, vLen, NULL, &val);
if (len < 0) {
return -1;
}
if (pVal != NULL) {
*pVal = (char*)val;
} else {
taosMemoryFree(val);
}
if (pVLen != NULL) *pVLen = len;

if (pKTmp->opNum != pCur->number) {
taosMemoryFree(val);
return -1;
}
if (pKey->groupId != 0 && pKey->groupId != pKTmp->key.groupId) {
taosMemoryFree(val);
return -1;
}

if (pVal != NULL) {
*pVal = (char*)val;
} else {
taosMemoryFree(val);
}

if (pVLen != NULL) *pVLen = len;
*pKey = pKTmp->key;
return 0;
}
Expand Down

0 comments on commit 5445e83

Please sign in to comment.