From c5e6dd73636dbb682852d95c55cb6bb0ad364ec5 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 d89af5356ad..16185ba1840 100644 --- a/src/backend/access/transam/xlogrecovery.c +++ b/src/backend/access/transam/xlogrecovery.c @@ -2180,6 +2180,7 @@ CheckTablespaceDirectory(void) errdetail("All directory entries in pg_tblspc/ should be symbolic links."), errhint("Remove those directories, or set \"allow_in_place_tablespaces\" to ON transiently to let recovery complete."))); } + FreeDir(dir); } /*