fix: memory leak
This commit is contained in:
parent
f4f08b24d2
commit
d3cc956b8c
|
@ -2075,6 +2075,7 @@ typedef struct SVCreateTbReq {
|
|||
|
||||
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) {
|
||||
|
|
|
@ -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