2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-31 06:15:55 +00:00

- Memory leak in the load_balance_mine() function is fixed. This would

leak ~20-30 octets per DHCPDISCOVER packet while failover was in use
  and in normal state. [ISC-Bugs #19548]

- Various compilation fixes have been included for the memory related
  DEBUG #defines in includes/site.h.  [ISC-Bugs #19548]
This commit is contained in:
David Hankins
2009-04-07 19:55:52 +00:00
parent e6b3a14046
commit 95fd7038a2
8 changed files with 49 additions and 20 deletions

View File

@@ -714,7 +714,9 @@ void new_address_range (cfile, low, high, subnet, pool, lpchain)
struct pool *pool;
struct lease **lpchain;
{
#if defined(COMPACT_LEASES)
struct lease *address_range;
#endif
unsigned min, max, i;
char lowbuf [16], highbuf [16], netbuf [16];
struct shared_network *share = subnet -> shared_network;
@@ -2614,7 +2616,7 @@ extern int end;
extern struct lease *lease_hunks;
#endif
void free_everything ()
void free_everything(void)
{
struct subnet *sc = (struct subnet *)0, *sn = (struct subnet *)0;
struct shared_network *nc = (struct shared_network *)0,
@@ -2625,12 +2627,8 @@ void free_everything ()
*in = (struct interface_info *)0;
struct class *cc = (struct class *)0, *cn = (struct class *)0;
struct collection *lp;
void *st = (shared_networks
? (shared_networks -> next
? shared_networks -> next -> next : 0) : 0);
int i;
/* Get rid of all the hash tables. */
if (host_hw_addr_hash)
host_free_hash_table (&host_hw_addr_hash, MDL);
@@ -2639,13 +2637,13 @@ void free_everything ()
host_free_hash_table (&host_uid_hash, MDL);
host_uid_hash = 0;
if (lease_uid_hash)
lease_free_hash_table (&lease_uid_hash, MDL);
lease_id_free_hash_table (&lease_uid_hash, MDL);
lease_uid_hash = 0;
if (lease_ip_addr_hash)
lease_free_hash_table (&lease_ip_addr_hash, MDL);
lease_ip_free_hash_table (&lease_ip_addr_hash, MDL);
lease_ip_addr_hash = 0;
if (lease_hw_addr_hash)
lease_free_hash_table (&lease_hw_addr_hash, MDL);
lease_id_free_hash_table (&lease_hw_addr_hash, MDL);
lease_hw_addr_hash = 0;
if (host_name_hash)
host_free_hash_table (&host_name_hash, MDL);
@@ -2751,7 +2749,15 @@ void free_everything ()
}
/* So are shared networks. */
/* XXX: this doesn't work presently, but i'm ok just filtering
* it out of the noise (you get a bigger spike on the real leaks).
* It would be good to fix this, but it is not a "real bug," so not
* today. This hack is incomplete, it doesn't trim out sub-values.
*/
if (shared_networks) {
shared_network_dereference (&shared_networks, MDL);
/* This is the old method (tries to free memory twice, broken) */
} else if (0) {
shared_network_reference (&nn, shared_networks, MDL);
do {
if (nn) {
@@ -2848,14 +2854,21 @@ void free_everything ()
universe_free_hash_table (&universe_hash, MDL);
for (i = 0; i < universe_count; i++) {
#if 0
union {
const char *c;
char *s;
} foo;
#endif
if (universes [i]) {
if (universes [i] -> hash)
option_free_hash_table (&universes [i] -> hash,
MDL);
if (universes[i]->name_hash)
option_name_free_hash_table(
&universes[i]->name_hash,
MDL);
if (universes[i]->code_hash)
option_code_free_hash_table(
&universes[i]->code_hash,
MDL);
#if 0
if (universes [i] -> name > (char *)&end) {
foo.c = universes [i] -> name;
@@ -2874,7 +2887,9 @@ void free_everything ()
relinquish_free_binding_values ();
relinquish_free_option_caches ();
relinquish_free_packets ();
#if defined(COMPACT_LEASES)
relinquish_lease_hunks ();
#endif
relinquish_hash_bucket_hunks ();
omapi_type_relinquish ();
}