From: Roy Marples Date: Tue, 13 May 2008 11:47:08 +0000 (+0000) Subject: Clean up some valgrind errors. X-Git-Tag: v4.0.2~423 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6164dc20c5a1ecc813713069fb9db674141d9815;p=thirdparty%2Fdhcpcd.git Clean up some valgrind errors. --- diff --git a/dhcp.c b/dhcp.c index ec2359f9..44792d69 100644 --- a/dhcp.c +++ b/dhcp.c @@ -265,15 +265,17 @@ _get_option(const struct dhcp_message *dhcp, uint8_t opt, int *type) overl &= ~2; p = dhcp->servername; e = p + sizeof(dhcp->servername); + } else { + errno = ENOENT; + return NULL; } break; case DHCP_OPTIONSOVERLOADED: /* Ensure we only get this option once */ - if (! overl) + if (!overl) overl = p[1]; break; } - l = *p++; p += l; } @@ -1114,8 +1116,8 @@ configure_env(char **env, const char *prefix, const struct dhcp_message *dhcp) ssize_t len, e = 0; char **ep; char cidr[4]; - uint8_t overl; - + uint8_t overl = 0; + get_option_uint8(&overl, dhcp, DHCP_OPTIONSOVERLOADED); if (!env) {