fix(tmq): memory leak in call back

This commit is contained in:
Liu Jicong 2022-08-15 11:26:50 +08:00
parent 6f75e03a55
commit 7fccac5029
1 changed files with 4 additions and 2 deletions

View File

@ -381,6 +381,9 @@ int32_t tmqCommitCb(void* param, SDataBuf* pBuf, int32_t code) {
} }
#endif #endif
taosMemoryFree(pParam->pOffset);
if (pBuf->pData) taosMemoryFree(pBuf->pData);
/*tscDebug("receive offset commit cb of %s on vgId:%d, offset is %" PRId64, pParam->pOffset->subKey, pParam->->vgId, /*tscDebug("receive offset commit cb of %s on vgId:%d, offset is %" PRId64, pParam->pOffset->subKey, pParam->->vgId,
* pOffset->version);*/ * pOffset->version);*/
@ -388,8 +391,6 @@ int32_t tmqCommitCb(void* param, SDataBuf* pBuf, int32_t code) {
int32_t waitingRspNum = atomic_sub_fetch_32(&pParamSet->waitingRspNum, 1); int32_t waitingRspNum = atomic_sub_fetch_32(&pParamSet->waitingRspNum, 1);
ASSERT(waitingRspNum >= 0); ASSERT(waitingRspNum >= 0);
taosMemoryFree(pParam);
if (waitingRspNum == 0) { if (waitingRspNum == 0) {
// if no more waiting rsp // if no more waiting rsp
if (pParamSet->async) { if (pParamSet->async) {
@ -1220,6 +1221,7 @@ END:
} else { } else {
taosMemoryFree(pParam); taosMemoryFree(pParam);
} }
taosMemoryFree(pMsg->pData);
return code; return code;
} }