This is an automated email from the ASF dual-hosted git repository.
reshke pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
The following commit(s) were added to refs/heads/main by this push:
new 26d373a19a6 Beautify `UpdateCatalogForStandbyPromotion`. (#1501)
26d373a19a6 is described below
commit 26d373a19a6536986b687ec438acbb9eb6137659
Author: reshke <[email protected]>
AuthorDate: Tue Dec 30 22:24:58 2025 +0500
Beautify `UpdateCatalogForStandbyPromotion`. (#1501)
Some variable declaration to beginning of function to
enforce C90 and long-standing coding practice of PostgreSQL.
Also, be tidy, and release memory allocated in GetDatabasePath.
This is not a real memory leak, as standby promotion happends
only once (until next restart).
Per coverity report 529246.
---
src/backend/access/transam/xlog.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/backend/access/transam/xlog.c
b/src/backend/access/transam/xlog.c
index 034aeb6473b..cff69879aa1 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -6528,6 +6528,7 @@ static void
UpdateCatalogForStandbyPromotion(void)
{
GpRoleValue old_role;
+ char *fullpath;
/*
* NOTE: The following initialization logic was borrowed from ftsprobe.
*/
@@ -6599,8 +6600,6 @@ UpdateCatalogForStandbyPromotion(void)
*/
RelationCacheInitializePhase2();
- char *fullpath;
-
/*
* In order to access the catalog, we need a database, and a
* tablespace; our access to the heap is going to be slightly
@@ -6620,6 +6619,7 @@ UpdateCatalogForStandbyPromotion(void)
fullpath = GetDatabasePath(MyDatabaseId, MyDatabaseTableSpace);
SetDatabasePath(fullpath);
+ pfree(fullpath);
RelationCacheInitializePhase3();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]