aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-07-12 05:15:20 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-07-12 05:15:20 +0000
commitcbdaa27f9798bfeb3bd04afadb5dccdcda361de3 (patch)
tree62f978e8acb95c2a481d5c79cd92965eb3e998a8 /src
parentbadce86a2c327b40c6146242526d1523455d64a6 (diff)
downloadpostgresql-cbdaa27f9798bfeb3bd04afadb5dccdcda361de3.tar.gz
postgresql-cbdaa27f9798bfeb3bd04afadb5dccdcda361de3.zip
Repair missing MEMORY_CONTEXT_CHECKING logic for realloc().
Doesn't anyone around here run regression tests before submitting patches, or before committing them?
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/mmgr/aset.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/backend/utils/mmgr/aset.c b/src/backend/utils/mmgr/aset.c
index 6c6f58b0222..12affe6731f 100644
--- a/src/backend/utils/mmgr/aset.c
+++ b/src/backend/utils/mmgr/aset.c
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.30 2000/07/12 02:37:23 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.31 2000/07/12 05:15:20 tgl Exp $
*
* NOTE:
* This is a new (Feb. 05, 1999) implementation of the allocation set
@@ -696,7 +696,17 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size)
*/
oldsize = AllocPointerGetSize(pointer);
if (oldsize >= size)
+ {
+#ifdef MEMORY_CONTEXT_CHECKING
+ AllocChunk chunk = AllocPointerGetChunk(pointer);
+
+ /* mark memory for memory leak searching */
+ memset(((char *) chunk) + (ALLOC_CHUNKHDRSZ + size),
+ 0x7F, chunk->size - size);
+ chunk->data_size = size;
+#endif
return pointer;
+ }
if (oldsize >= ALLOC_BIGCHUNK_LIMIT)
{
@@ -711,7 +721,6 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size)
AllocBlock block = set->blocks;
AllocBlock prevblock = NULL;
Size blksize;
-
#ifdef MEMORY_CONTEXT_CHECKING
Size data_size = size;
#endif