From cde0f9c6a2a54f965b2405ad06e857b2cbbe47de Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Wed, 14 Oct 2026 11:12:39 +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/xlog.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index bb84525e665..a835f77b734 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -8333,6 +8333,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); } /*