aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2019-10-29 19:18:07 -0700
committerAndres Freund <andres@anarazel.de>2019-10-29 19:28:34 -0700
commit4ab353c477e6f585973b171a2652551574cbbc45 (patch)
treee78fb8c0f5d6d26cf728ddf5a7a04f77b6c9831f /src
parenteae1ba65fab4790c350264714b5eb7581c5e62be (diff)
downloadpostgresql-4ab353c477e6f585973b171a2652551574cbbc45.tar.gz
postgresql-4ab353c477e6f585973b171a2652551574cbbc45.zip
pg_waldump: Fix small memory leak when rmgr->rm_identify returns NULL.
This got broken in 604f7956b94, shortly after rm_identify's introduction. Author: Andres Freund Discussion: https://postgr.es/m/20191029233341.4gnyau7e5v2lh5sc@alap3.anarazel.de Backpatch: 9.5, where rm_identify was introduced
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_waldump/pg_waldump.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/bin/pg_waldump/pg_waldump.c b/src/bin/pg_waldump/pg_waldump.c
index b95d467805a..28839d76e15 100644
--- a/src/bin/pg_waldump/pg_waldump.c
+++ b/src/bin/pg_waldump/pg_waldump.c
@@ -533,17 +533,18 @@ XLogDumpDisplayRecord(XLogDumpConfig *config, XLogReaderState *record)
XLogDumpRecordLen(record, &rec_len, &fpi_len);
- id = desc->rm_identify(info);
- if (id == NULL)
- id = psprintf("UNKNOWN (%x)", info & ~XLR_INFO_MASK);
-
printf("rmgr: %-11s len (rec/tot): %6u/%6u, tx: %10u, lsn: %X/%08X, prev %X/%08X, ",
desc->rm_name,
rec_len, XLogRecGetTotalLen(record),
XLogRecGetXid(record),
(uint32) (record->ReadRecPtr >> 32), (uint32) record->ReadRecPtr,
(uint32) (xl_prev >> 32), (uint32) xl_prev);
- printf("desc: %s ", id);
+
+ id = desc->rm_identify(info);
+ if (id == NULL)
+ printf("desc: UNKNOWN (%x) ", info & ~XLR_INFO_MASK);
+ else
+ printf("desc: %s ", id);
/* the desc routine will printf the description directly to stdout */
desc->rm_desc(NULL, record);