]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Check for non-null group-name-hash before traversing it.
authorTed Lemon <source@isc.org>
Tue, 5 Oct 1999 18:44:27 +0000 (18:44 +0000)
committerTed Lemon <source@isc.org>
Tue, 5 Oct 1999 18:44:27 +0000 (18:44 +0000)
server/mdb.c

index 9571f2e7af8fdc507bc05a2540adc943147377ba..669393624da1d9881ce27f925d8ed859c8217d95 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: mdb.c,v 1.5 1999/10/05 02:47:12 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: mdb.c,v 1.6 1999/10/05 18:44:27 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -1226,7 +1226,8 @@ void write_leases ()
        int i;
 
        /* Write all the dynamically-created group declarations. */
-       for (i = 0; i < group_name_hash -> hash_count; i++) {
+       if (group_name_hash) {
+           for (i = 0; i < group_name_hash -> hash_count; i++) {
                for (hb = group_name_hash -> buckets [i];
                     hb; hb = hb -> next) {
                        gp = (struct group_object *)hb -> value;
@@ -1235,6 +1236,7 @@ void write_leases ()
                             (gp -> flags & GROUP_OBJECT_DELETED)))
                                write_group (gp);
                }
+           }
        }
 
        /* Write all the dynamically-created host declarations. */