Skip to content

Commit cbdaa27

Browse files
committed
Repair missing MEMORY_CONTEXT_CHECKING logic for realloc().
Doesn't anyone around here run regression tests before submitting patches, or before committing them?
1 parent badce86 commit cbdaa27

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/backend/utils/mmgr/aset.c

+11-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1994, Regents of the University of California
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.30 2000/07/12 02:37:23 tgl Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.31 2000/07/12 05:15:20 tgl Exp $
1515
*
1616
* NOTE:
1717
* This is a new (Feb. 05, 1999) implementation of the allocation set
@@ -696,7 +696,17 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size)
696696
*/
697697
oldsize = AllocPointerGetSize(pointer);
698698
if (oldsize >= size)
699+
{
700+
#ifdef MEMORY_CONTEXT_CHECKING
701+
AllocChunk chunk = AllocPointerGetChunk(pointer);
702+
703+
/* mark memory for memory leak searching */
704+
memset(((char *) chunk) + (ALLOC_CHUNKHDRSZ + size),
705+
0x7F, chunk->size - size);
706+
chunk->data_size = size;
707+
#endif
699708
return pointer;
709+
}
700710

701711
if (oldsize >= ALLOC_BIGCHUNK_LIMIT)
702712
{
@@ -711,7 +721,6 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size)
711721
AllocBlock block = set->blocks;
712722
AllocBlock prevblock = NULL;
713723
Size blksize;
714-
715724
#ifdef MEMORY_CONTEXT_CHECKING
716725
Size data_size = size;
717726
#endif

0 commit comments

Comments
 (0)