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

Lines changed: 11 additions & 2 deletions
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)
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