From: Fujii Masao Date: Mon, 6 Apr 2026 14:04:18 +0000 (+0900) Subject: Release postmaster working memory context in slotsync worker X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=93dc1ace2007fe7c1103ccda3d7bc13b4eb4352f;p=thirdparty%2Fpostgresql.git Release postmaster working memory context in slotsync worker Child processes do not need the postmaster's working memory context and normally release it at the start of their main entry point. However, the slotsync worker forgot to do so. This commit makes the slotsync worker release the postmaster's working memory context at startup, preventing unintended use. Author: Fujii Masao Reviewed-by: Andres Freund Reviewed-by: Tom Lane Reviewed-by: Tiancheng Ge Reviewed-by: Chao Li Discussion: https://postgr.es/m/CAHGQGwHO05JaUpgKF8FBDmPdBUJsK22axRRcgmAUc2Jyi8OK8g@mail.gmail.com --- diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c index d615ff8a81c..8b53bd3ac7f 100644 --- a/src/backend/replication/logical/slotsync.c +++ b/src/backend/replication/logical/slotsync.c @@ -1494,6 +1494,13 @@ ReplSlotSyncWorkerMain(const void *startup_data, size_t startup_data_len) Assert(startup_data_len == 0); + /* Release postmaster's working memory context */ + if (PostmasterContext) + { + MemoryContextDelete(PostmasterContext); + PostmasterContext = NULL; + } + init_ps_display(NULL); Assert(GetProcessingMode() == InitProcessing);