fix mem leak
This commit is contained in:
parent
5aa0f80c91
commit
a1d143384a
|
@ -119,7 +119,7 @@ static FORCE_INLINE void* tDecodeDataBlock(void* buf, SSDataBlock* pBlock) {
|
||||||
buf = taosDecodeFixedI32(buf, &sz);
|
buf = taosDecodeFixedI32(buf, &sz);
|
||||||
pBlock->pDataBlock = taosArrayInit(sz, sizeof(SColumnInfoData));
|
pBlock->pDataBlock = taosArrayInit(sz, sizeof(SColumnInfoData));
|
||||||
for (int32_t i = 0; i < sz; i++) {
|
for (int32_t i = 0; i < sz; i++) {
|
||||||
SColumnInfoData data;
|
SColumnInfoData data = {0};
|
||||||
buf = taosDecodeFixedI16(buf, &data.info.colId);
|
buf = taosDecodeFixedI16(buf, &data.info.colId);
|
||||||
buf = taosDecodeFixedI16(buf, &data.info.type);
|
buf = taosDecodeFixedI16(buf, &data.info.type);
|
||||||
buf = taosDecodeFixedI16(buf, &data.info.bytes);
|
buf = taosDecodeFixedI16(buf, &data.info.bytes);
|
||||||
|
@ -167,7 +167,7 @@ static FORCE_INLINE void* tDecodeSMqConsumeRsp(void* buf, SMqConsumeRsp* pRsp) {
|
||||||
buf = taosDecodeFixedI32(buf, &sz);
|
buf = taosDecodeFixedI32(buf, &sz);
|
||||||
pRsp->pBlockData = taosArrayInit(sz, sizeof(SSDataBlock));
|
pRsp->pBlockData = taosArrayInit(sz, sizeof(SSDataBlock));
|
||||||
for (int32_t i = 0; i < sz; i++) {
|
for (int32_t i = 0; i < sz; i++) {
|
||||||
SSDataBlock block;
|
SSDataBlock block = {0};
|
||||||
tDecodeDataBlock(buf, &block);
|
tDecodeDataBlock(buf, &block);
|
||||||
taosArrayPush(pRsp->pBlockData, &block);
|
taosArrayPush(pRsp->pBlockData, &block);
|
||||||
}
|
}
|
||||||
|
|
|
@ -462,7 +462,7 @@ int32_t tmq_poll_cb_inner(void* param, const SDataBuf* pMsg, int32_t code) {
|
||||||
char pBuf[128];
|
char pBuf[128];
|
||||||
SMqConsumeCbParam* pParam = (SMqConsumeCbParam*)param;
|
SMqConsumeCbParam* pParam = (SMqConsumeCbParam*)param;
|
||||||
SMqClientVg* pVg = pParam->pVg;
|
SMqClientVg* pVg = pParam->pVg;
|
||||||
SMqConsumeRsp rsp;
|
SMqConsumeRsp rsp = {0};
|
||||||
tDecodeSMqConsumeRsp(pMsg->pData, &rsp);
|
tDecodeSMqConsumeRsp(pMsg->pData, &rsp);
|
||||||
if (rsp.numOfTopics == 0) {
|
if (rsp.numOfTopics == 0) {
|
||||||
/*printf("no data\n");*/
|
/*printf("no data\n");*/
|
||||||
|
|
|
@ -69,7 +69,7 @@ int32_t mndInitSubscribe(SMnode *pMnode) {
|
||||||
static int32_t mndProcessGetSubEpReq(SMnodeMsg *pMsg) {
|
static int32_t mndProcessGetSubEpReq(SMnodeMsg *pMsg) {
|
||||||
SMnode *pMnode = pMsg->pMnode;
|
SMnode *pMnode = pMsg->pMnode;
|
||||||
SMqCMGetSubEpReq *pReq = (SMqCMGetSubEpReq *)pMsg->rpcMsg.pCont;
|
SMqCMGetSubEpReq *pReq = (SMqCMGetSubEpReq *)pMsg->rpcMsg.pCont;
|
||||||
SMqCMGetSubEpRsp rsp;
|
SMqCMGetSubEpRsp rsp = {0};
|
||||||
int64_t consumerId = be64toh(pReq->consumerId);
|
int64_t consumerId = be64toh(pReq->consumerId);
|
||||||
int64_t currentTs = taosGetTimestampMs();
|
int64_t currentTs = taosGetTimestampMs();
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ static int32_t mndProcessGetSubEpReq(SMnodeMsg *pMsg) {
|
||||||
}
|
}
|
||||||
void *abuf = buf;
|
void *abuf = buf;
|
||||||
tEncodeSMqCMGetSubEpRsp(&abuf, &rsp);
|
tEncodeSMqCMGetSubEpRsp(&abuf, &rsp);
|
||||||
// TODO: free rsp
|
tDeleteSMqCMGetSubEpRsp(&rsp);
|
||||||
pMsg->pCont = buf;
|
pMsg->pCont = buf;
|
||||||
pMsg->contLen = tlen;
|
pMsg->contLen = tlen;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -240,15 +240,14 @@ static int32_t mndCreateTopic(SMnode *pMnode, SMnodeMsg *pMsg, SCMCreateTopicReq
|
||||||
topicObj.uid = mndGenerateUid(pCreate->name, strlen(pCreate->name));
|
topicObj.uid = mndGenerateUid(pCreate->name, strlen(pCreate->name));
|
||||||
topicObj.dbUid = pDb->uid;
|
topicObj.dbUid = pDb->uid;
|
||||||
topicObj.version = 1;
|
topicObj.version = 1;
|
||||||
topicObj.sql = strdup(pCreate->sql);
|
topicObj.sql = pCreate->sql;
|
||||||
topicObj.physicalPlan = strdup(pCreate->physicalPlan);
|
topicObj.physicalPlan = pCreate->physicalPlan;
|
||||||
topicObj.logicalPlan = strdup(pCreate->logicalPlan);
|
topicObj.logicalPlan = pCreate->logicalPlan;
|
||||||
topicObj.sqlLen = strlen(pCreate->sql);
|
topicObj.sqlLen = strlen(pCreate->sql);
|
||||||
|
|
||||||
SSdbRaw *pTopicRaw = mndTopicActionEncode(&topicObj);
|
SSdbRaw *pTopicRaw = mndTopicActionEncode(&topicObj);
|
||||||
if (pTopicRaw == NULL) return -1;
|
if (pTopicRaw == NULL) return -1;
|
||||||
if (sdbSetRawStatus(pTopicRaw, SDB_STATUS_READY) != 0) return -1;
|
if (sdbSetRawStatus(pTopicRaw, SDB_STATUS_READY) != 0) return -1;
|
||||||
// TODO: replace with trans to support recovery
|
|
||||||
return sdbWrite(pMnode->pSdb, pTopicRaw);
|
return sdbWrite(pMnode->pSdb, pTopicRaw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue