From: adrian <> Date: Sat, 25 Nov 2000 23:02:14 +0000 (+0000) Subject: few changes to fix for XMALLOC_DEBUG: X-Git-Tag: SQUID_3_0_PRE1~1758 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8eb042dc9b26fa9f152f7a87fa73d768eb540809;p=thirdparty%2Fsquid.git few changes to fix for XMALLOC_DEBUG: - check_free shouldn't be called with a NULL pointer - I needed to increase DBG_ARRY_SZ to handle larger alloc count (perhaps should we use realloc here to grow dynamically?) - cf_gen.c used inconsitently alloc funcs: xcalloc() but free(), resulting in check_free() to assert during make using cf_gen Submitted by: Andres Kroomnaa --- diff --git a/lib/util.c b/lib/util.c index 67fc4999ff..70d8e44975 100644 --- a/lib/util.c +++ b/lib/util.c @@ -1,6 +1,6 @@ /* - * $Id: util.c,v 1.73 2000/10/20 23:50:59 hno Exp $ + * $Id: util.c,v 1.74 2000/11/25 16:02:14 adrian Exp $ * * DEBUG: * AUTHOR: Harvest Derived @@ -177,7 +177,7 @@ size_t xmalloc_total = 0; #endif #if XMALLOC_DEBUG -#define DBG_ARRY_SZ (1<<10) +#define DBG_ARRY_SZ (1<<11) #define DBG_ARRY_BKTS (1<<8) static void *(*malloc_ptrs)[DBG_ARRY_SZ]; static int malloc_size[DBG_ARRY_BKTS][DBG_ARRY_SZ]; @@ -474,7 +474,8 @@ xfree(void *s) #endif #if XMALLOC_DEBUG - check_free(s); + if (s != NULL) + check_free(s); #endif if (s != NULL) free(s); diff --git a/src/cf_gen.cc b/src/cf_gen.cc index 300991c118..1e6441fe81 100644 --- a/src/cf_gen.cc +++ b/src/cf_gen.cc @@ -1,6 +1,6 @@ /* - * $Id: cf_gen.cc,v 1.36 2000/06/06 19:34:31 hno Exp $ + * $Id: cf_gen.cc,v 1.37 2000/11/25 16:02:14 adrian Exp $ * * DEBUG: none Generate squid.conf and cf_parser.c * AUTHOR: Max Okumoto @@ -608,8 +608,8 @@ gen_conf(Entry * head, FILE * fp) line = def; def = line->next; fprintf(fp, "# %s\n", line->data); - free(line->data); - free(line); + xfree(line->data); + xfree(line); } blank = 1; }