mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Fix error handling of XLogReaderAllocate in case of OOM
Similarly to previous fix9b8d478
, commit2c03216
has switched XLogReaderAllocate() to use a set of palloc calls instead of malloc, causing any callers of this function to fail with an error instead of receiving a NULL pointer in case of out-of-memory error. Fix this by using palloc_extended with MCXT_ALLOC_NO_OOM that will safely return NULL in case of an OOM. Michael Paquier, slightly modified by me.
This commit is contained in:
@ -1062,8 +1062,11 @@ XLogInsertRecord(XLogRecData *rdata, XLogRecPtr fpw_lsn)
|
||||
if (!debug_reader)
|
||||
debug_reader = XLogReaderAllocate(NULL, NULL);
|
||||
|
||||
if (!debug_reader ||
|
||||
!DecodeXLogRecord(debug_reader, (XLogRecord *) recordBuf.data,
|
||||
if (!debug_reader)
|
||||
{
|
||||
appendStringInfo(&buf, "error decoding record: out of memory");
|
||||
}
|
||||
else if (!DecodeXLogRecord(debug_reader, (XLogRecord *) recordBuf.data,
|
||||
&errormsg))
|
||||
{
|
||||
appendStringInfo(&buf, "error decoding record: %s",
|
||||
|
Reference in New Issue
Block a user