refact: free func update when build submit req
This commit is contained in:
parent
79c047c5d0
commit
614462b878
|
@ -3264,7 +3264,8 @@ void tDestroySSubmitRsp2(SSubmitRsp2* pRsp, int32_t flag);
|
||||||
#define TSDB_MSG_FLG_ENCODE 0x1
|
#define TSDB_MSG_FLG_ENCODE 0x1
|
||||||
#define TSDB_MSG_FLG_DECODE 0x2
|
#define TSDB_MSG_FLG_DECODE 0x2
|
||||||
|
|
||||||
int32_t tBuildSubmitReq(int32_t vgId, SSubmitReq2* pReq, void** pData, uint32_t* pLen, __tmalloc_fn_t fp);
|
int32_t tBuildSubmitReq(int32_t vgId, SSubmitReq2* pReq, void** pData, uint32_t* pLen, __tmalloc_fn_t fp,
|
||||||
|
__tfree_fn_t ff);
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ void *taosMemoryMallocAlign(uint32_t alignment, int64_t size);
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
typedef void *(*__tmalloc_fn_t)(int64_t);
|
typedef void *(*__tmalloc_fn_t)(int64_t);
|
||||||
|
typedef void (*__tfree_fn_t)(void *);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -7001,7 +7001,7 @@ void tDestroySSubmitRsp2(SSubmitRsp2 *pRsp, int32_t flag) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tBuildSubmitReq(int32_t vgId, SSubmitReq2 *pReq, void **pData, uint32_t *pLen, __tmalloc_fn_t fp) {
|
int32_t tBuildSubmitReq(int32_t vgId, SSubmitReq2 *pReq, void **pData, uint32_t *pLen, __tmalloc_fn_t fp, __tfree_fn_t ff) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
uint32_t len = 0;
|
uint32_t len = 0;
|
||||||
void *pBuf = NULL;
|
void *pBuf = NULL;
|
||||||
|
@ -7024,7 +7024,7 @@ int32_t tBuildSubmitReq(int32_t vgId, SSubmitReq2 *pReq, void **pData, uint32_t
|
||||||
*pData = pBuf;
|
*pData = pBuf;
|
||||||
*pLen = len;
|
*pLen = len;
|
||||||
} else {
|
} else {
|
||||||
taosMemoryFree(pBuf);
|
(*ff)(pBuf);
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
|
@ -463,7 +463,7 @@ int32_t tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchema* p
|
||||||
taosArrayPush(pReq->aSubmitTbData, pTbData);
|
taosArrayPush(pReq->aSubmitTbData, pTbData);
|
||||||
}
|
}
|
||||||
|
|
||||||
terrno = tBuildSubmitReq(TD_VID(pVnode), pReq, ppData, pLen, rpcMallocCont);
|
terrno = tBuildSubmitReq(TD_VID(pVnode), pReq, ppData, pLen, rpcMallocCont, rpcFreeCont);
|
||||||
|
|
||||||
_end:
|
_end:
|
||||||
taosArrayDestroy(tagArray);
|
taosArrayDestroy(tagArray);
|
||||||
|
|
Loading…
Reference in New Issue