Skip to content

Commit 0319cb3

Browse files
committed
Fix lsan issues in pg_resetwal
1 parent efe9f04 commit 0319cb3

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

contrib/pg_tde/src/access/pg_tde_tdemap.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,9 @@ pg_tde_create_wal_key(InternalKey *rel_key_data, const RelFileLocator *newrlocat
522522

523523
pg_tde_write_key_map_entry(newrlocator, rel_key_data, principal_key);
524524

525+
#ifdef FRONTEND
526+
free(principal_key);
527+
#endif
525528
LWLockRelease(tde_lwlock_enc_keys());
526529
}
527530

src/bin/pg_resetwal/pg_resetwal.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,11 @@ main(int argc, char *argv[])
408408
WalSegSz = ControlFile.xlog_seg_size;
409409

410410
if (log_fname != NULL)
411+
{
411412
XLogFromFileName(log_fname, &minXlogTli, &minXlogSegNo, WalSegSz);
413+
free(log_fname);
414+
}
415+
412416

413417
/*
414418
* Also look at existing segment files to set up newXlogSegNo
@@ -639,6 +643,8 @@ read_controlfile(void)
639643

640644
memcpy(&ControlFile, buffer, sizeof(ControlFile));
641645

646+
free(buffer);
647+
642648
/* return false if WAL segment size is not valid */
643649
if (!IsValidWalSegSize(ControlFile.xlog_seg_size))
644650
{
@@ -652,6 +658,8 @@ read_controlfile(void)
652658
return true;
653659
}
654660

661+
free(buffer);
662+
655663
/* Looks like it's a mess. */
656664
pg_log_warning("pg_control exists but is broken or wrong version; ignoring it");
657665
return false;

0 commit comments

Comments
 (0)