From 24cb3e8f4a99320a59ec36172ca41ded3f935034 Mon Sep 17 00:00:00 2001
From: "Chao Li (Evan)" <lic@highgo.com>
Date: Sat, 10 Oct 2026 16:54:39 +0800
Subject: [PATCH v1] Add missing FreeDir in CheckTablespaceDirectory

This seems to be an oversight in 9e4f914b5eba, where
CheckTablespaceDirectory() was introduced. I searched the source
tree, and this is the only place where FreeDir() is missing after
AllocateDir().

Author: Chao Li <lic@highgo.com>
---
 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 54aaec9529f..20be788da78 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -2154,6 +2154,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);
 }
 
 /*
-- 
2.50.1 (Apple Git-155)

