Skip to content

Commit 6513946

Browse files
committed
Extend #ifdef CLOBBER_FREED_MEMORY debugging option so that memory
freed wholesale by AllocSetReset() is overwritten too.
1 parent 84a89e2 commit 6513946

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/backend/utils/mmgr/aset.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.24 2000/01/31 04:35:53 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.25 2000/03/08 23:42:58 tgl Exp $
1212
*
1313
* NOTE:
1414
* This is a new (Feb. 05, 1999) implementation of the allocation set
@@ -173,6 +173,10 @@ AllocSetReset(AllocSet set)
173173
while (block != NULL)
174174
{
175175
next = block->next;
176+
#ifdef CLOBBER_FREED_MEMORY
177+
/* Wipe freed memory for debugging purposes */
178+
memset(block, 0x7F, ((char *) block->endptr) - ((char *) block));
179+
#endif
176180
free(block);
177181
block = next;
178182
}
@@ -419,6 +423,10 @@ AllocSetFree(AllocSet set, AllocPointer pointer)
419423
set->blocks = block->next;
420424
else
421425
prevblock->next = block->next;
426+
#ifdef CLOBBER_FREED_MEMORY
427+
/* Wipe freed memory for debugging purposes */
428+
memset(block, 0x7F, ((char *) block->endptr) - ((char *) block));
429+
#endif
422430
free(block);
423431
}
424432
else

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