aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/mmgr/mcxt.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c
index 68f1cbcf9c2..506f2902986 100644
--- a/src/backend/utils/mmgr/mcxt.c
+++ b/src/backend/utils/mmgr/mcxt.c
@@ -1181,6 +1181,10 @@ MemoryContextCreate(MemoryContext node,
/* Creating new memory contexts is not allowed in a critical section */
Assert(CritSectionCount == 0);
+ /* Validate parent, to help prevent crazy context linkages */
+ Assert(parent == NULL || MemoryContextIsValid(parent));
+ Assert(node != parent);
+
/* Initialize all standard fields of memory context header */
node->type = tag;
node->isReset = true;