fix: memory leak
This commit is contained in:
parent
f4f08b24d2
commit
d3cc956b8c
|
@ -2073,8 +2073,9 @@ typedef struct SVCreateTbReq {
|
|||
};
|
||||
} SVCreateTbReq;
|
||||
|
||||
int tEncodeSVCreateTbReq(SEncoder* pCoder, const SVCreateTbReq* pReq);
|
||||
int tDecodeSVCreateTbReq(SDecoder* pCoder, SVCreateTbReq* pReq);
|
||||
int tEncodeSVCreateTbReq(SEncoder* pCoder, const SVCreateTbReq* pReq);
|
||||
int tDecodeSVCreateTbReq(SDecoder* pCoder, SVCreateTbReq* pReq);
|
||||
void tDestroySVCreateTbReq(SVCreateTbReq* pReq, int32_t flags);
|
||||
|
||||
static FORCE_INLINE void tdDestroySVCreateTbReq(SVCreateTbReq* req) {
|
||||
if (NULL == req) {
|
||||
|
|
|
@ -992,7 +992,7 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
|
|||
if (tEncodeI32(&encoder, vlen) < 0) return -1;
|
||||
for (int32_t i = 0; i < vlen; ++i) {
|
||||
SVnodeLoad *pload = taosArrayGet(pReq->pVloads, i);
|
||||
int64_t reserved = 0;
|
||||
int64_t reserved = 0;
|
||||
if (tEncodeI32(&encoder, pload->vgId) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pload->syncState) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pload->syncRestore) < 0) return -1;
|
||||
|
@ -5696,6 +5696,25 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void tDestroySVCreateTbReq(SVCreateTbReq *pReq, int32_t flags) {
|
||||
if (pReq == NULL) return;
|
||||
|
||||
if (flags & TSDB_MSG_FLG_ENCODE) {
|
||||
// TODO
|
||||
} else if (flags & TSDB_MSG_FLG_DECODE) {
|
||||
if (pReq->comment) {
|
||||
pReq->comment = NULL;
|
||||
taosMemoryFree(pReq->comment);
|
||||
}
|
||||
|
||||
if (pReq->type == TSDB_CHILD_TABLE) {
|
||||
if (pReq->ctb.tagName) taosArrayDestroy(pReq->ctb.tagName);
|
||||
} else if (pReq->type == TSDB_NORMAL_TABLE) {
|
||||
if (pReq->ntb.schemaRow.pSchema) taosMemoryFree(pReq->ntb.schemaRow.pSchema);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int tEncodeSVCreateTbBatchReq(SEncoder *pCoder, const SVCreateTbBatchReq *pReq) {
|
||||
int32_t nReq = taosArrayGetSize(pReq->pArray);
|
||||
|
||||
|
@ -6896,6 +6915,7 @@ void tDestroySSubmitTbData(SSubmitTbData *pTbData, int32_t flag) {
|
|||
}
|
||||
} else if (flag == TSDB_MSG_FLG_DECODE) {
|
||||
if (pTbData->pCreateTbReq) {
|
||||
tDestroySVCreateTbReq(pTbData->pCreateTbReq, TSDB_MSG_FLG_DECODE);
|
||||
taosMemoryFree(pTbData->pCreateTbReq);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue