From 797ddd3256a86c91870554780f11e477cdd82c60 Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Wed, 14 Oct 2026 11:11:08 +0900 Subject: [PATCH] Add missing FreeDir() in CheckTablespaceDirectory() CheckTablespaceDirectory() did not close the directory opened with AllocateDir(), leaving its resources held during subsequent recovery, potentially indefinitely on a standby. Add the missing FreeDir() call. Backpatch to all supported versions. Author: Chao Li Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/66A784B7-55C1-4613-8C24-B4C2A8D75414@gmail.com Backpatch-through: 14 --- src/backend/access/transam/xlogrecovery.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c index f51eeac35da..d1df80faa3f 100644 --- a/src/backend/access/transam/xlogrecovery.c +++ b/src/backend/access/transam/xlogrecovery.c @@ -2149,6 +2149,7 @@ CheckTablespaceDirectory(void) PG_TBLSPC_DIR), errhint("Remove those directories, or set \"allow_in_place_tablespaces\" to ON transiently to let recovery complete."))); } + FreeDir(dir); } /*