!97 fix free problem

Merge pull request !97 from shipixian/dev_performance
This commit is contained in:
裴庭伟 2023-03-29 04:10:14 +00:00 committed by Gitee
commit 422d2b2a2a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
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);