From: Thomas Markwalder Date: Thu, 18 Feb 2016 16:21:42 +0000 (-0500) Subject: [master] Fixed several minor Coverity issues X-Git-Tag: v4_3_4~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=45086eef45e6abf1937468820f71d1fbdba5f8e8;p=thirdparty%2Fdhcp.git [master] Fixed several minor Coverity issues Merges in rt35144. --- diff --git a/RELNOTES b/RELNOTES index 91f926be4..bd8b6e13f 100644 --- a/RELNOTES +++ b/RELNOTES @@ -224,6 +224,9 @@ by Eric Young (eay@cryptsoft.com). Section 22.4. [ISC-Bugs #25687] +- Corrected minor Coverity issues. + [ISC-Bugs #35144] + Changes since 4.3.3b1 - None diff --git a/common/options.c b/common/options.c index 74f1fb54e..5abccf89c 100644 --- a/common/options.c +++ b/common/options.c @@ -3,7 +3,7 @@ DHCP options parsing and reassembly. */ /* - * Copyright (c) 2004-2012,2014-2015 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2016 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -4344,7 +4344,7 @@ void parse_vendor_option(packet, lease, client_state, in_options, return; memset(&name, 0, sizeof(name)); - evaluate_option_cache(&name, packet, lease, client_state, + (void) evaluate_option_cache(&name, packet, lease, client_state, in_options, out_options, scope, oc, MDL); /* No name, all done */ diff --git a/server/confpars.c b/server/confpars.c index 6358fe2db..bc85b3b6b 100644 --- a/server/confpars.c +++ b/server/confpars.c @@ -3,7 +3,7 @@ Parser for dhcpd config file... */ /* - * Copyright (c) 2004-2015 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2016 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -1177,17 +1177,10 @@ void parse_failover_peer (cfile, group, type) group->shared_network->failover_peer = peer; /* Set the initial state. */ - if (peer -> i_am == primary) { - peer -> me.state = recover; - peer -> me.stos = cur_time; - peer -> partner.state = unknown_state; - peer -> partner.stos = cur_time; - } else { - peer -> me.state = recover; - peer -> me.stos = cur_time; - peer -> partner.state = unknown_state; - peer -> partner.stos = cur_time; - } + peer->me.state = recover; + peer->me.stos = cur_time; + peer->partner.state = unknown_state; + peer->partner.stos = cur_time; status = enter_failover_peer (peer); if (status != ISC_R_SUCCESS) diff --git a/server/dhcpv6.c b/server/dhcpv6.c index f6bf15c96..d85d0b070 100644 --- a/server/dhcpv6.c +++ b/server/dhcpv6.c @@ -5424,7 +5424,6 @@ iterate_over_ia_na(struct data_string *reply_ret, struct data_string cli_enc_opt_data; struct option_state *cli_enc_opt_state; struct host_decl *host; - struct option_state *host_opt_state; struct data_string iaaddr; struct data_string fixed_addr; char reply_data[65536]; @@ -5445,7 +5444,6 @@ iterate_over_ia_na(struct data_string *reply_ret, cli_enc_opt_state = NULL; memset(&iaaddr, 0, sizeof(iaaddr)); memset(&fixed_addr, 0, sizeof(fixed_addr)); - host_opt_state = NULL; lease = NULL; /* @@ -5658,9 +5656,6 @@ exit: if (lease != NULL) { iasubopt_dereference(&lease, MDL); } - if (host_opt_state != NULL) { - option_state_dereference(&host_opt_state, MDL); - } if (fixed_addr.buffer != NULL) { data_string_forget(&fixed_addr, MDL); } @@ -5933,7 +5928,6 @@ iterate_over_ia_pd(struct data_string *reply_ret, struct data_string cli_enc_opt_data; struct option_state *cli_enc_opt_state; struct host_decl *host; - struct option_state *host_opt_state; struct data_string iaprefix; char reply_data[65536]; int reply_ofs; @@ -5951,7 +5945,6 @@ iterate_over_ia_pd(struct data_string *reply_ret, memset(&cli_enc_opt_data, 0, sizeof(cli_enc_opt_data)); cli_enc_opt_state = NULL; memset(&iaprefix, 0, sizeof(iaprefix)); - host_opt_state = NULL; prefix = NULL; /* @@ -6131,9 +6124,6 @@ exit: if (prefix != NULL) { iasubopt_dereference(&prefix, MDL); } - if (host_opt_state != NULL) { - option_state_dereference(&host_opt_state, MDL); - } if (iaprefix.buffer != NULL) { data_string_forget(&iaprefix, MDL); } diff --git a/server/failover.c b/server/failover.c index f6e9a6d7f..b2cfa5c21 100644 --- a/server/failover.c +++ b/server/failover.c @@ -5497,8 +5497,7 @@ secondary_not_hoarding(dhcp_failover_state_t *state, struct pool *p) { isc_result_t dhcp_failover_process_bind_ack (dhcp_failover_state_t *state, failover_message_t *msg) { - struct lease *lt = (struct lease *)0; - struct lease *lease = (struct lease *)0; + struct lease *lease = NULL; struct iaddr ia; const char *message = "no memory"; u_int32_t pot_expire; @@ -5646,9 +5645,6 @@ isc_result_t dhcp_failover_process_bind_ack (dhcp_failover_state_t *state, out: lease_dereference (&lease, MDL); - if (lt) - lease_dereference (<, MDL); - return ISC_R_SUCCESS; bad: