]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
few changes to fix for XMALLOC_DEBUG:
authoradrian <>
Sat, 25 Nov 2000 23:02:14 +0000 (23:02 +0000)
committeradrian <>
Sat, 25 Nov 2000 23:02:14 +0000 (23:02 +0000)
 - 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 <andre@online.ee>

lib/util.c
src/cf_gen.cc

index 67fc4999ff895b100de01a08b153bc395371d50a..70d8e44975c20f91a6510079305ab1af8f1606d3 100644 (file)
@@ -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);
index 300991c11875e795067c69ef5f42afdc767f0fca..1e6441fe819900affe7cb3050f71785c04dadbab 100644 (file)
@@ -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;
        }