From: Heikki Linnakangas Date: Mon, 27 Jul 2015 15:27:27 +0000 (+0300) Subject: Fix memory leak in xlogreader facility. X-Git-Tag: REL9_6_BETA1~1629 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=61a65c53bd3e48e7ff7661a528d1791dfd956957;p=postgresql 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. --- diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c index a9e926c5a2..f1b209b1ad 100644 --- a/src/backend/access/transam/xlogreader.c +++ b/src/backend/access/transam/xlogreader.c @@ -126,11 +126,8 @@ XLogReaderFree(XLogReaderState *state) 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) - pfree(state->blocks[block_id].data); - } + if (state->blocks[block_id].data) + pfree(state->blocks[block_id].data); } if (state->main_data) pfree(state->main_data);