]> granicus.if.org Git - postgresql/commitdiff
Fix memory leak in xlogreader facility.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 27 Jul 2015 15:27:27 +0000 (18:27 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 27 Jul 2015 15:29:31 +0000 (18:29 +0300)
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.

src/backend/access/transam/xlogreader.c

index a9e926c5a283d81d23ea00d330a15f5e0fd0b144..f1b209b1ad1a82ac3919555208213b1595e960ed 100644 (file)
@@ -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);