From: Ted Lemon Date: Mon, 12 Jun 2000 20:08:56 +0000 (+0000) Subject: - Fix interface_dummy to notice reference error. X-Git-Tag: V3-BETA-2-PATCH-1~155 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0b1c50ebb02a28bf038f8cb4aabc03eac5a5a77;p=thirdparty%2Fdhcp.git - Fix interface_dummy to notice reference error. - Fix interface parser to zero interface pointer before using it. --- diff --git a/client/clparse.c b/client/clparse.c index c52d1fc07..14c8342e0 100644 --- a/client/clparse.c +++ b/client/clparse.c @@ -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; }