Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2ed7ab1

Browse files
committed
Merge branch 'PGPROEE9_6_atx' into PGPROEE9_6
2 parents aceada0 + 517289c commit 2ed7ab1

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/backend/access/transam/multixact.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,7 +1378,7 @@ mXactCachePut(MultiXactId multi, int nmembers, MultiXactMember *members)
13781378
{
13791379
/* The cache only lives as long as the current transaction */
13801380
debug_elog2(DEBUG2, "CachePut: initializing memory context");
1381-
MXactContext = AllocSetContextCreate(TopTransactionContext,
1381+
MXactContext = AllocSetContextCreate(TopMemoryContext,
13821382
"MultiXact cache context",
13831383
ALLOCSET_SMALL_SIZES);
13841384
}
@@ -1484,7 +1484,11 @@ AtEOXact_MultiXact(void)
14841484
* Discard the local MultiXactId cache. Since MXactContext was created as
14851485
* a child of TopTransactionContext, we needn't delete it explicitly.
14861486
*/
1487-
MXactContext = NULL;
1487+
if (MXactContext)
1488+
{
1489+
MemoryContextDelete(MXactContext);
1490+
MXactContext = NULL;
1491+
}
14881492
dlist_init(&MXactCache);
14891493
MXactCacheMembers = 0;
14901494
}
@@ -1551,7 +1555,11 @@ PostPrepare_MultiXact(TransactionId xid)
15511555
/*
15521556
* Discard the local MultiXactId cache like in AtEOX_MultiXact
15531557
*/
1554-
MXactContext = NULL;
1558+
if (MXactContext)
1559+
{
1560+
MemoryContextDelete(MXactContext);
1561+
MXactContext = NULL;
1562+
}
15551563
dlist_init(&MXactCache);
15561564
MXactCacheMembers = 0;
15571565
}

0 commit comments

Comments
 (0)