]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
More xxFreeMemory() functions and fixes
authorwessels <>
Fri, 11 Oct 1996 01:04:14 +0000 (01:04 +0000)
committerwessels <>
Fri, 11 Oct 1996 01:04:14 +0000 (01:04 +0000)
src/fqdncache.cc
src/ipcache.cc
src/net_db.cc
src/store.cc
src/tools.cc

index 2f41b9f208928b7ea7b4e3303798cf1af0c5d64d..b70213368f34cf8efcecc5b71ae55c87e21c4283 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: fqdncache.cc,v 1.22 1996/10/09 15:34:25 wessels Exp $
+ * $Id: fqdncache.cc,v 1.23 1996/10/10 19:04:14 wessels Exp $
  *
  * DEBUG: section 35    FQDN Cache
  * AUTHOR: Harvest Derived
@@ -872,3 +872,30 @@ fqdncacheQueueDrain(void)
        fqdncache_dnsDispatch(dnsData, i);
     return 1;
 }
+
+void
+fqdncacheFreeMemory(void)
+{
+    fqdncache_entry *f;
+    fqdncache_entry **list;
+    int k = 0;
+    int j;
+    list = xcalloc(meta_data.fqdncache_count, sizeof(fqdncache_entry *));
+    f = (fqdncache_entry *) hash_first(fqdn_table);
+    while (f && k < meta_data.fqdncache_count) {
+        *(list + k) = f;
+        k++;
+        f = (fqdncache_entry *) hash_next(fqdn_table);
+    }
+    for (j = 0; j < k; j++) {
+        f = *(list + j);
+        for (k = 0; k < (int) f->name_count; k++)
+            safe_free(f->names[k]);
+        safe_free(f->name);
+        safe_free(f->error_message);
+        safe_free(f);
+    }
+    xfree(list);
+    hashFreeMemory(fqdn_table);
+}
+
index 5c6fc57d75d373859f57777f1c22bd6930b8743e..a6c0c3838dead63ceee0d0a30f340407085b0c73 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ipcache.cc,v 1.68 1996/10/09 22:49:37 wessels Exp $
+ * $Id: ipcache.cc,v 1.69 1996/10/10 19:04:16 wessels Exp $
  *
  * DEBUG: section 14    IP Cache
  * AUTHOR: Harvest Derived
@@ -1010,3 +1010,28 @@ ipcacheRemoveBadAddr(char *name, struct in_addr addr)
     if (ia->cur >= ia->count)
        ia->cur = 0;
 }
+
+void
+ipcacheFreeMemory(void)
+{
+    ipcache_entry *i;
+    ipcache_entry **list;
+    int k = 0;
+    int j;
+    list = xcalloc(meta_data.ipcache_count, sizeof(ipcache_entry *));
+    i = (ipcache_entry *) hash_first(ip_table);
+    while (i && k < meta_data.ipcache_count) {
+        *(list + k) = i;
+        k++;
+        i = (ipcache_entry *) hash_next(ip_table);
+    }
+    for (j = 0; j < k; j++) {
+       i = *(list + j);
+        safe_free(i->addrs.in_addrs);
+        safe_free(i->name);
+        safe_free(i->error_message);
+        safe_free(i);
+    }
+    xfree(list);
+    hashFreeMemory(ip_table);
+}
index 90cba5cd04fbea396299274e329d0d6893c56700..ed5460b6b3ed3e400d41411f8edc5c89a6477ff1 100644 (file)
@@ -310,7 +310,7 @@ netdbFreeMemory(void)
     int i = 0;
     int j;
 
-    L1 = xcalloc(meta_data.netdb_addrs, sizeof(netdbEntry));
+    L1 = xcalloc(meta_data.netdb_addrs, sizeof(netdbEntry *));
     n = (netdbEntry *) hash_first(addr_table);
     while (n && i < meta_data.netdb_addrs) {
        *(L1 + i) = n;
@@ -328,7 +328,7 @@ netdbFreeMemory(void)
     xfree(L1);
 
     i = 0;
-    L2 = xcalloc(meta_data.netdb_hosts, sizeof(netdbEntry));
+    L2 = xcalloc(meta_data.netdb_hosts, sizeof(hash_link *));
     h = hash_first(host_table);
     while (h && i < meta_data.netdb_hosts) {
        *(L2 + i) = h;
index b46d6735eeb0d9994fa67de0b8e5b0738fc09183..35ceb5e250be14ce96ca644c72967f5827ebecc9 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.128 1996/10/10 18:52:23 wessels Exp $
+ * $Id: store.cc,v 1.129 1996/10/10 19:04:19 wessels Exp $
  *
  * DEBUG: section 20    Storeage Manager
  * AUTHOR: Harvest Derived
@@ -2875,7 +2875,7 @@ storeFreeMemory(void)
     StoreEntry **list;
     int i = 0;
     int j;
-    list = xcalloc(meta_data.store_entries, sizeof(StoreEntry));
+    list = xcalloc(meta_data.store_entries, sizeof(StoreEntry *));
     e = (StoreEntry *) hash_first(store_table);
     while (e && i < meta_data.store_entries) {
        *(list + i) = e;
index fef61fda0481c58036eb17b6406e5e95472ffca3..9b68f6d5c88f711661e5e1f2764147386bbe4b71 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.68 1996/10/09 22:49:44 wessels Exp $
+ * $Id: tools.cc,v 1.69 1996/10/10 19:04:20 wessels Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -309,6 +309,8 @@ normal_shutdown(void)
     errorpageFreeMemory();
     stmemFreeMemory();
     netdbFreeMemory();
+    ipcacheFreeMemory();
+    fqdncacheFreeMemory();
     debug(21, 0, "Squid Cache (Version %s): Exiting normally.\n",
        version_string);
     exit(0);