mem leak
This commit is contained in:
parent
17907ff8b9
commit
0e5053b3de
|
@ -530,7 +530,8 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy
|
||||||
|
|
||||||
if(pWal->cfg.encryptAlgorithm == DND_CA_SM4){
|
if(pWal->cfg.encryptAlgorithm == DND_CA_SM4){
|
||||||
cyptedBodyLen = ENCRYPTED_LEN(cyptedBodyLen);
|
cyptedBodyLen = ENCRYPTED_LEN(cyptedBodyLen);
|
||||||
char* newBody = taosMemoryMalloc(cyptedBodyLen);
|
|
||||||
|
newBody = taosMemoryMalloc(cyptedBodyLen);
|
||||||
if(newBody == NULL){
|
if(newBody == NULL){
|
||||||
wError("vgId:%d, file:%" PRId64 ".log, failed to malloc since %s", pWal->cfg.vgId, walGetLastFileFirstVer(pWal),
|
wError("vgId:%d, file:%" PRId64 ".log, failed to malloc since %s", pWal->cfg.vgId, walGetLastFileFirstVer(pWal),
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
@ -540,7 +541,7 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy
|
||||||
memset(newBody, 0, cyptedBodyLen);
|
memset(newBody, 0, cyptedBodyLen);
|
||||||
memcpy(newBody, body, plainBodyLen);
|
memcpy(newBody, body, plainBodyLen);
|
||||||
|
|
||||||
char* newBodyEncrypted = taosMemoryMalloc(cyptedBodyLen);
|
newBodyEncrypted = taosMemoryMalloc(cyptedBodyLen);
|
||||||
if(newBodyEncrypted == NULL){
|
if(newBodyEncrypted == NULL){
|
||||||
wError("vgId:%d, file:%" PRId64 ".log, failed to malloc since %s", pWal->cfg.vgId, walGetLastFileFirstVer(pWal),
|
wError("vgId:%d, file:%" PRId64 ".log, failed to malloc since %s", pWal->cfg.vgId, walGetLastFileFirstVer(pWal),
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
@ -570,15 +571,15 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
code = -1;
|
code = -1;
|
||||||
if(pWal->cfg.encryptAlgorithm == DND_CA_SM4){
|
if(pWal->cfg.encryptAlgorithm == DND_CA_SM4){
|
||||||
taosMemoryFree(newBody);
|
taosMemoryFreeClear(newBody);
|
||||||
taosMemoryFree(newBodyEncrypted);
|
taosMemoryFreeClear(newBodyEncrypted);
|
||||||
}
|
}
|
||||||
goto END;
|
goto END;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pWal->cfg.encryptAlgorithm == DND_CA_SM4){
|
if(pWal->cfg.encryptAlgorithm == DND_CA_SM4){
|
||||||
taosMemoryFree(newBody);
|
taosMemoryFreeClear(newBody);
|
||||||
taosMemoryFree(newBodyEncrypted);
|
taosMemoryFreeClear(newBodyEncrypted);
|
||||||
//wInfo("vgId:%d, free newBody newBodyEncrypted %s",
|
//wInfo("vgId:%d, free newBody newBodyEncrypted %s",
|
||||||
// pWal->cfg.vgId, __FUNCTION__);
|
// pWal->cfg.vgId, __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue