Commit 61a65c53 authored by Heikki Linnakangas's avatar Heikki Linnakangas

Fix memory leak in xlogreader facility.

XLogReaderFree failed to free the per-block data buffers, when they
happened to not be used by the latest read WAL record.

Michael Paquier. Backpatch to 9.5, where the per-block buffers were added.
parent 33444517
...@@ -125,13 +125,10 @@ XLogReaderFree(XLogReaderState *state) ...@@ -125,13 +125,10 @@ XLogReaderFree(XLogReaderState *state)
int block_id; int block_id;
for (block_id = 0; block_id <= state->max_block_id; block_id++) for (block_id = 0; block_id <= state->max_block_id; block_id++)
{
if (state->blocks[block_id].in_use)
{ {
if (state->blocks[block_id].data) if (state->blocks[block_id].data)
pfree(state->blocks[block_id].data); pfree(state->blocks[block_id].data);
} }
}
if (state->main_data) if (state->main_data)
pfree(state->main_data); pfree(state->main_data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment