fix:memory leak
This commit is contained in:
parent
d8d6b6dd21
commit
827e84b1a5
|
@ -570,8 +570,8 @@ typedef struct {
|
||||||
SEpSet epSet;
|
SEpSet epSet;
|
||||||
} SMqVgEp;
|
} SMqVgEp;
|
||||||
|
|
||||||
//SMqVgEp* tCloneSMqVgEp(const SMqVgEp* pVgEp);
|
SMqVgEp* tCloneSMqVgEp(const SMqVgEp* pVgEp);
|
||||||
//void tDeleteSMqVgEp(SMqVgEp* pVgEp);
|
void tDeleteSMqVgEp(SMqVgEp* pVgEp);
|
||||||
int32_t tEncodeSMqVgEp(void** buf, const SMqVgEp* pVgEp);
|
int32_t tEncodeSMqVgEp(void** buf, const SMqVgEp* pVgEp);
|
||||||
void* tDecodeSMqVgEp(const void* buf, SMqVgEp* pVgEp, int8_t sver);
|
void* tDecodeSMqVgEp(const void* buf, SMqVgEp* pVgEp, int8_t sver);
|
||||||
|
|
||||||
|
|
|
@ -183,21 +183,21 @@ void tFreeStreamObj(SStreamObj *pStream) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//SMqVgEp *tCloneSMqVgEp(const SMqVgEp *pVgEp) {
|
SMqVgEp *tCloneSMqVgEp(const SMqVgEp *pVgEp) {
|
||||||
// SMqVgEp *pVgEpNew = taosMemoryMalloc(sizeof(SMqVgEp));
|
SMqVgEp *pVgEpNew = taosMemoryMalloc(sizeof(SMqVgEp));
|
||||||
// if (pVgEpNew == NULL) return NULL;
|
if (pVgEpNew == NULL) return NULL;
|
||||||
// pVgEpNew->vgId = pVgEp->vgId;
|
pVgEpNew->vgId = pVgEp->vgId;
|
||||||
//// pVgEpNew->qmsg = taosStrdup(pVgEp->qmsg);
|
// pVgEpNew->qmsg = taosStrdup(pVgEp->qmsg);
|
||||||
// pVgEpNew->epSet = pVgEp->epSet;
|
pVgEpNew->epSet = pVgEp->epSet;
|
||||||
// return pVgEpNew;
|
return pVgEpNew;
|
||||||
//}
|
}
|
||||||
|
|
||||||
//void tDeleteSMqVgEp(SMqVgEp *pVgEp) {
|
void tDeleteSMqVgEp(SMqVgEp *pVgEp) {
|
||||||
// if (pVgEp) {
|
if (pVgEp) {
|
||||||
//// taosMemoryFreeClear(pVgEp->qmsg);
|
// taosMemoryFreeClear(pVgEp->qmsg);
|
||||||
// taosMemoryFree(pVgEp);
|
taosMemoryFree(pVgEp);
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
int32_t tEncodeSMqVgEp(void **buf, const SMqVgEp *pVgEp) {
|
int32_t tEncodeSMqVgEp(void **buf, const SMqVgEp *pVgEp) {
|
||||||
int32_t tlen = 0;
|
int32_t tlen = 0;
|
||||||
|
@ -517,11 +517,11 @@ SMqSubscribeObj *tCloneSubscribeObj(const SMqSubscribeObj *pSub) {
|
||||||
pConsumerEp = (SMqConsumerEp *)pIter;
|
pConsumerEp = (SMqConsumerEp *)pIter;
|
||||||
SMqConsumerEp newEp = {
|
SMqConsumerEp newEp = {
|
||||||
.consumerId = pConsumerEp->consumerId,
|
.consumerId = pConsumerEp->consumerId,
|
||||||
.vgs = taosArrayDup(pConsumerEp->vgs, NULL),
|
.vgs = taosArrayDup(pConsumerEp->vgs, (__array_item_dup_fn_t)tCloneSMqVgEp),
|
||||||
};
|
};
|
||||||
taosHashPut(pSubNew->consumerHash, &newEp.consumerId, sizeof(int64_t), &newEp, sizeof(SMqConsumerEp));
|
taosHashPut(pSubNew->consumerHash, &newEp.consumerId, sizeof(int64_t), &newEp, sizeof(SMqConsumerEp));
|
||||||
}
|
}
|
||||||
pSubNew->unassignedVgs = taosArrayDup(pSub->unassignedVgs, NULL);
|
pSubNew->unassignedVgs = taosArrayDup(pSub->unassignedVgs, (__array_item_dup_fn_t)tCloneSMqVgEp);
|
||||||
pSubNew->offsetRows = taosArrayDup(pSub->offsetRows, NULL);
|
pSubNew->offsetRows = taosArrayDup(pSub->offsetRows, NULL);
|
||||||
memcpy(pSubNew->dbName, pSub->dbName, TSDB_DB_FNAME_LEN);
|
memcpy(pSubNew->dbName, pSub->dbName, TSDB_DB_FNAME_LEN);
|
||||||
pSubNew->qmsg = taosStrdup(pSub->qmsg);
|
pSubNew->qmsg = taosStrdup(pSub->qmsg);
|
||||||
|
@ -534,11 +534,11 @@ void tDeleteSubscribeObj(SMqSubscribeObj *pSub) {
|
||||||
pIter = taosHashIterate(pSub->consumerHash, pIter);
|
pIter = taosHashIterate(pSub->consumerHash, pIter);
|
||||||
if (pIter == NULL) break;
|
if (pIter == NULL) break;
|
||||||
SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter;
|
SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter;
|
||||||
taosArrayDestroy(pConsumerEp->vgs);
|
taosArrayDestroyP(pConsumerEp->vgs, (FDelete)tDeleteSMqVgEp);
|
||||||
taosArrayDestroy(pConsumerEp->offsetRows);
|
taosArrayDestroy(pConsumerEp->offsetRows);
|
||||||
}
|
}
|
||||||
taosHashCleanup(pSub->consumerHash);
|
taosHashCleanup(pSub->consumerHash);
|
||||||
taosArrayDestroy(pSub->unassignedVgs);
|
taosArrayDestroyP(pSub->unassignedVgs, (FDelete)tDeleteSMqVgEp);
|
||||||
taosMemoryFreeClear(pSub->qmsg);
|
taosMemoryFreeClear(pSub->qmsg);
|
||||||
taosArrayDestroy(pSub->offsetRows);
|
taosArrayDestroy(pSub->offsetRows);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue