Skip to content

Commit 94e90d9

Browse files
committed
Add some more Assert checks.
1 parent 7893462 commit 94e90d9

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/backend/utils/mmgr/mcxt.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*
1616
* IDENTIFICATION
17-
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.23 2000/07/11 14:30:28 momjian Exp $
17+
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.24 2000/08/22 04:00:10 tgl Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -114,6 +114,8 @@ MemoryContextInit(void)
114114
void
115115
MemoryContextReset(MemoryContext context)
116116
{
117+
AssertArg(MemoryContextIsValid(context));
118+
117119
MemoryContextResetChildren(context);
118120
(*context->methods->reset) (context);
119121
}
@@ -129,6 +131,8 @@ MemoryContextResetChildren(MemoryContext context)
129131
{
130132
MemoryContext child;
131133

134+
AssertArg(MemoryContextIsValid(context));
135+
132136
for (child = context->firstchild; child != NULL; child = child->nextchild)
133137
{
134138
MemoryContextReset(child);
@@ -148,6 +152,7 @@ MemoryContextResetChildren(MemoryContext context)
148152
void
149153
MemoryContextDelete(MemoryContext context)
150154
{
155+
AssertArg(MemoryContextIsValid(context));
151156
/* We had better not be deleting TopMemoryContext ... */
152157
Assert(context != TopMemoryContext);
153158
/* And not CurrentMemoryContext, either */
@@ -194,6 +199,7 @@ MemoryContextDelete(MemoryContext context)
194199
void
195200
MemoryContextDeleteChildren(MemoryContext context)
196201
{
202+
AssertArg(MemoryContextIsValid(context));
197203
/*
198204
* MemoryContextDelete will delink the child from me,
199205
* so just iterate as long as there is a child.
@@ -215,6 +221,8 @@ MemoryContextDeleteChildren(MemoryContext context)
215221
void
216222
MemoryContextResetAndDeleteChildren(MemoryContext context)
217223
{
224+
AssertArg(MemoryContextIsValid(context));
225+
218226
MemoryContextDeleteChildren(context);
219227
(*context->methods->reset) (context);
220228
}
@@ -231,6 +239,8 @@ MemoryContextStats(MemoryContext context)
231239
{
232240
MemoryContext child;
233241

242+
AssertArg(MemoryContextIsValid(context));
243+
234244
(*context->methods->stats) (context);
235245
for (child = context->firstchild; child != NULL; child = child->nextchild)
236246
{
@@ -251,6 +261,8 @@ MemoryContextCheck(MemoryContext context)
251261
{
252262
MemoryContext child;
253263

264+
AssertArg(MemoryContextIsValid(context));
265+
254266
(*context->methods->check) (context);
255267
for (child = context->firstchild; child != NULL; child = child->nextchild)
256268
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy