Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9b8d478

Browse files
committed
Rework handling of OOM when allocating record buffer in XLOG reader.
Commit2c03216 changed allocate_recordbuf() so that it uses a palloc toallocate the read buffer and fails immediately when an out-of-memory errorshows up, even though its callers still expect that NULL is returned in thatcase. This bug is fixed making allocate_recordbuf() use a palloc_extendedwith MCXT_ALLOC_NO_OOM flag and return NULL in OOM case.Michael Paquier
1 parent8c8a886 commit9b8d478

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎src/backend/access/transam/xlogreader.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,13 @@ allocate_recordbuf(XLogReaderState *state, uint32 reclength)
146146

147147
if (state->readRecordBuf)
148148
pfree(state->readRecordBuf);
149-
state->readRecordBuf= (char*)palloc(newSize);
149+
state->readRecordBuf=
150+
(char*)palloc_extended(newSize,MCXT_ALLOC_NO_OOM);
151+
if (state->readRecordBuf==NULL)
152+
{
153+
state->readRecordBufSize=0;
154+
return false;
155+
}
150156
state->readRecordBufSize=newSize;
151157
return true;
152158
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp