fix free problem

Signed-off-by: shipixian <shipixian_yewu@cmss.chinamobile.com>
This commit is contained in:
shipixian 2023-03-29 11:30:09 +08:00
parent f326eba527
commit 87f185d1af
3 changed files with 5 additions and 5 deletions

View File

@ -1231,7 +1231,7 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
free(pageXlogPtr);
pageXlogPtr = NULL;
} else if (tWalRecord.count != 0) {
free_dataRead(tWalRecord.buf,1,1);
free_dataRead(tWalRecord.buf,tWalRecord.count,tWalRecord.cap);
FreeLsnNode(head);
} else {
if (walRecord.buf != NULL) {

View File

@ -2437,7 +2437,7 @@ MasterFileRead(char *buffer,uint32_t dbid, uint32_t relid, uint32_t forkno, uint
if (bufrd.count > 0)
{
memcpy(buffer,bufrd.buf,bufrd.count);
free_dataRead(bufrd.buf,1,1);
free_dataRead(bufrd.buf,bufrd.count, bufrd.cap);
}
return bufrd.count;

View File

@ -772,7 +772,7 @@ he3db_mdread_pagexlog(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknu
nbytes = bufrd.count;
*buffer = (uint8_t *)malloc(bufrd.count);
memcpy(*buffer, bufrd.buf,bufrd.count);
free_dataRead(bufrd.buf, 1,1);
free_dataRead(bufrd.buf, bufrd.count, bufrd.cap);
if (push_standby)
{
Assert(bufrd.count == BLCKSZ);
@ -789,7 +789,7 @@ he3db_mdread_pagexlog(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknu
nbytes += result.count;
*buffer = (uint8_t *)realloc(*buffer, BLCKSZ + result.count);
strcat(*buffer,result.buf);
free_dataRead(result.buf, 1,1);
free_dataRead(result.buf, result.count, result.cap);
}
//TODO free result
FreeLsnNode(head);
@ -845,7 +845,7 @@ he3db_mdread_pagexlog(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknu
buf = (uint8_t *)realloc(buf, BLCKSZ + result.count);
strcat(buf,result.buf);
//TODO free result
free_dataRead(result.buf, 1,1);
free_dataRead(result.buf, result.count, result.cap);
}
*buffer = buf;
FreeLsnNode(head);