From ba97097eaf33f05372a7309c5be3cf1d614f16cd Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 4 Mar 2010 05:59:07 +0000 Subject: [PATCH] 2955. [bug] The size of a memory allocation was not always properly recorded. [RT #20927] --- CHANGES | 3 +++ lib/isc/include/isc/mem.h | 4 ++-- lib/isc/mem.c | 13 +++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index d6cb79716b..30b97d2758 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2955. [bug] The size of a memory allocation was not always properly + recorded. [RT #20927] + 2853. [bug] add_sigs() could run out of scratch space. [RT #21015] 2852. [bug] Handle broken DNSSEC trust chains better. [RT #15619] diff --git a/lib/isc/include/isc/mem.h b/lib/isc/include/isc/mem.h index 480a934078..5c0c4e652c 100644 --- a/lib/isc/include/isc/mem.h +++ b/lib/isc/include/isc/mem.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: mem.h,v 1.78.120.3 2009/02/11 03:07:01 jinmei Exp $ */ +/* $Id: mem.h,v 1.78.120.4 2010/03/04 05:59:07 marka Exp $ */ #ifndef ISC_MEM_H #define ISC_MEM_H 1 @@ -121,7 +121,7 @@ LIBISC_EXTERNAL_DATA extern unsigned int isc_mem_debugging; #if ISC_MEM_TRACKLINES #define _ISC_MEM_FILELINE , __FILE__, __LINE__ -#define _ISC_MEM_FLARG , const char *, int +#define _ISC_MEM_FLARG , const char *, unsigned int #else #define _ISC_MEM_FILELINE #define _ISC_MEM_FLARG diff --git a/lib/isc/mem.c b/lib/isc/mem.c index 9c37d7478b..69052cda72 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: mem.c,v 1.145.120.4 2009/02/16 03:17:05 marka Exp $ */ +/* $Id: mem.c,v 1.145.120.5 2010/03/04 05:59:07 marka Exp $ */ /*! \file */ @@ -72,7 +72,7 @@ struct debuglink { }; #define FLARG_PASS , file, line -#define FLARG , const char *file, int line +#define FLARG , const char *file, unsigned int line #else #define FLARG_PASS #define FLARG @@ -220,6 +220,7 @@ add_trace_entry(isc_mem_t *mctx, const void *ptr, unsigned int size { debuglink_t *dl; unsigned int i; + unsigned int mysize = size; if ((isc_mem_debugging & ISC_MEM_DEBUGTRACE) != 0) fprintf(stderr, isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM, @@ -231,10 +232,10 @@ add_trace_entry(isc_mem_t *mctx, const void *ptr, unsigned int size if (mctx->debuglist == NULL) return; - if (size > mctx->max_size) - size = mctx->max_size; + if (mysize > mctx->max_size) + mysize = mctx->max_size; - dl = ISC_LIST_HEAD(mctx->debuglist[size]); + dl = ISC_LIST_HEAD(mctx->debuglist[mysize]); while (dl != NULL) { if (dl->count == DEBUGLIST_COUNT) goto next; @@ -269,7 +270,7 @@ add_trace_entry(isc_mem_t *mctx, const void *ptr, unsigned int size dl->line[0] = line; dl->count = 1; - ISC_LIST_PREPEND(mctx->debuglist[size], dl, link); + ISC_LIST_PREPEND(mctx->debuglist[mysize], dl, link); mctx->debuglistcnt++; }