Skip to content

Commit e3ff8c3

Browse files
committed
pg_waldump: Fix small memory leak when rmgr->rm_identify returns NULL.
This got broken in 604f795, 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
1 parent 9bf2476 commit e3ff8c3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/bin/pg_waldump/pg_waldump.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -448,17 +448,18 @@ XLogDumpDisplayRecord(XLogDumpConfig *config, XLogReaderState *record)
448448

449449
XLogDumpRecordLen(record, &rec_len, &fpi_len);
450450

451-
id = desc->rm_identify(info);
452-
if (id == NULL)
453-
id = psprintf("UNKNOWN (%x)", info & ~XLR_INFO_MASK);
454-
455451
printf("rmgr: %-11s len (rec/tot): %6u/%6u, tx: %10u, lsn: %X/%08X, prev %X/%08X, ",
456452
desc->rm_name,
457453
rec_len, XLogRecGetTotalLen(record),
458454
XLogRecGetXid(record),
459455
(uint32) (record->ReadRecPtr >> 32), (uint32) record->ReadRecPtr,
460456
(uint32) (xl_prev >> 32), (uint32) xl_prev);
461-
printf("desc: %s ", id);
457+
458+
id = desc->rm_identify(info);
459+
if (id == NULL)
460+
printf("desc: UNKNOWN (%x) ", info & ~XLR_INFO_MASK);
461+
else
462+
printf("desc: %s ", id);
462463

463464
/* the desc routine will printf the description directly to stdout */
464465
desc->rm_desc(NULL, record);

0 commit comments

Comments
 (0)