]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
- Fix interface_dummy to notice reference error.
authorTed Lemon <source@isc.org>
Mon, 12 Jun 2000 20:08:56 +0000 (20:08 +0000)
committerTed Lemon <source@isc.org>
Mon, 12 Jun 2000 20:08:56 +0000 (20:08 +0000)
- Fix interface parser to zero interface pointer before using it.

client/clparse.c

index c52d1fc0732a79c259d5b55c13fa7fce8535a0ec..14c8342e0485dfc311c7482085845441d3a278f8 100644 (file)
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: clparse.c,v 1.45 2000/06/02 21:26:55 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: clparse.c,v 1.46 2000/06/12 20:08:56 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -633,7 +633,7 @@ void parse_interface_declaration (cfile, outer_config, name)
        int token;
        const char *val;
        struct client_state *client, **cp;
-       struct interface_info *ip;
+       struct interface_info *ip = (struct interface_info *)0;
 
        token = next_token (&val, cfile);
        if (token != STRING) {
@@ -642,7 +642,8 @@ void parse_interface_declaration (cfile, outer_config, name)
                return;
        }
 
-       interface_or_dummy (&ip, val);
+       if (!interface_or_dummy (&ip, val))
+               log_fatal ("Can't allocate interface %s.", val);
 
        /* If we were given a name, this is a pseudo-interface. */
        if (name) {
@@ -691,6 +692,7 @@ int interface_or_dummy (struct interface_info **pi, const char *name)
 {
        struct interface_info *i;
        struct interface_info *ip = (struct interface_info *)0;
+       isc_result_t status;
 
        /* Find the interface (if any) that matches the name. */
        for (i = interfaces; i; i = i -> next) {
@@ -727,8 +729,10 @@ int interface_or_dummy (struct interface_info **pi, const char *name)
                interface_reference (&dummy_interfaces, ip, MDL);
        }
        if (pi)
-               interface_reference (pi, ip, MDL);
+               status = interface_reference (pi, ip, MDL);
        interface_dereference (&ip, MDL);
+       if (status != ISC_R_SUCCESS)
+               return 0;
        return 1;
 }