Skip to content

Fix lsan issues in pg_resetwal #498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions contrib/pg_tde/src/access/pg_tde_tdemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,9 @@ pg_tde_create_wal_key(InternalKey *rel_key_data, const RelFileLocator *newrlocat

pg_tde_write_key_map_entry(newrlocator, rel_key_data, principal_key);

#ifdef FRONTEND
free(principal_key);
#endif
LWLockRelease(tde_lwlock_enc_keys());
}

Expand Down
8 changes: 8 additions & 0 deletions src/bin/pg_resetwal/pg_resetwal.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,11 @@ main(int argc, char *argv[])
WalSegSz = ControlFile.xlog_seg_size;

if (log_fname != NULL)
{
XLogFromFileName(log_fname, &minXlogTli, &minXlogSegNo, WalSegSz);
free(log_fname);
}


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

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

free(buffer);

/* return false if WAL segment size is not valid */
if (!IsValidWalSegSize(ControlFile.xlog_seg_size))
{
Expand All @@ -652,6 +658,8 @@ read_controlfile(void)
return true;
}

free(buffer);

/* Looks like it's a mess. */
pg_log_warning("pg_control exists but is broken or wrong version; ignoring it");
return false;
Expand Down