]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
- merge rt13330
authorDavid Hankins <dhankins@isc.org>
Tue, 22 Feb 2005 21:14:19 +0000 (21:14 +0000)
committerDavid Hankins <dhankins@isc.org>
Tue, 22 Feb 2005 21:14:19 +0000 (21:14 +0000)
RELNOTES
server/dhcp.c

index 8dbe01390f02f8b2c54496847632362c2946adca..44dcb987149cf0eb27dd5aa24855785a0284fa09 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -81,6 +81,11 @@ and for prodding me into improving it.
   meaning the 'next server in the bootstrap process', eg a tftp server.
   The siaddr field is now left zeroed unless next-server is configured.
 
+- mockup_lease() could have returned in an error condition (or in the
+  condition where no fixed-address was found matching the shared
+  network) with stale references to a host record.  This is probably not
+  a memory leak since host records generally never die anyway.
+
                        Changes since 3.0.2rc3
 
 - A previously undocumented configuration directive, 'local-address',
index c75b3f8cbb3dbdeba4087bc7e2fd495c815818fe..6272379b9a5e0ece96935621c4b7e23702f10f85 100644 (file)
@@ -34,7 +34,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dhcp.c,v 1.192.2.45 2005/02/22 21:11:51 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: dhcp.c,v 1.192.2.46 2005/02/22 21:14:19 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -3581,18 +3581,18 @@ int mockup_lease (struct lease **lp, struct packet *packet,
                  struct shared_network *share, struct host_decl *hp)
 {
        struct lease *lease = (struct lease *)0;
-       const unsigned char **s;
-       isc_result_t status;
        struct host_decl *rhp = (struct host_decl *)0;
        
-       status = lease_allocate (&lease, MDL);
-       if (status != ISC_R_SUCCESS)
+       if (lease_allocate (&lease, MDL) != ISC_R_SUCCESS)
                return 0;
-       if (host_reference (&rhp, hp, MDL) != ISC_R_SUCCESS)
+       if (host_reference (&rhp, hp, MDL) != ISC_R_SUCCESS) {
+               lease_dereference (&lease, MDL);
                return 0;
+       }
        if (!find_host_for_network (&lease -> subnet,
                                    &rhp, &lease -> ip_addr, share)) {
                lease_dereference (&lease, MDL);
+               host_dereference (&rhp, MDL);
                return 0;
        }
        host_reference (&lease -> host, rhp, MDL);
@@ -3612,7 +3612,9 @@ int mockup_lease (struct lease **lp, struct packet *packet,
        lease -> starts = lease -> timestamp = lease -> ends = MIN_TIME;
        lease -> flags = STATIC_LEASE;
        lease -> binding_state = FTS_FREE;
+
        lease_reference (lp, lease, MDL);
+
        lease_dereference (&lease, MDL);
        host_dereference (&rhp, MDL);
        return 1;