Skip to content

Commit 26d373a

Browse files
authored
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.
1 parent e0bd15d commit 26d373a

File tree

1 file changed

+2
-2
lines changed
  • src/backend/access/transam

1 file changed

+2
-2
lines changed

src/backend/access/transam/xlog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6528,6 +6528,7 @@ static void
65286528
UpdateCatalogForStandbyPromotion(void)
65296529
{
65306530
GpRoleValue old_role;
6531+
char *fullpath;
65316532
/*
65326533
* NOTE: The following initialization logic was borrowed from ftsprobe.
65336534
*/
@@ -6599,8 +6600,6 @@ UpdateCatalogForStandbyPromotion(void)
65996600
*/
66006601
RelationCacheInitializePhase2();
66016602

6602-
char *fullpath;
6603-
66046603
/*
66056604
* In order to access the catalog, we need a database, and a
66066605
* tablespace; our access to the heap is going to be slightly
@@ -6620,6 +6619,7 @@ UpdateCatalogForStandbyPromotion(void)
66206619
fullpath = GetDatabasePath(MyDatabaseId, MyDatabaseTableSpace);
66216620

66226621
SetDatabasePath(fullpath);
6622+
pfree(fullpath);
66236623

66246624
RelationCacheInitializePhase3();
66256625

0 commit comments

Comments
 (0)