Merge pull request #13641 from donaldsharp/com_list_str

Bunch of code cleanup from Coverity
This commit is contained in:
mobash-rasool 2023-06-02 08:14:10 +05:30 committed by GitHub
commit 205d27014f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 22 deletions

View File

@ -899,15 +899,13 @@ int community_list_set(struct community_list_handler *ch, const char *name,
}
}
if (str) {
if (style == COMMUNITY_LIST_STANDARD)
com = community_str2com(str);
else
regex = bgp_regcomp(str);
if (style == COMMUNITY_LIST_STANDARD)
com = community_str2com(str);
else
regex = bgp_regcomp(str);
if (!com && !regex)
return COMMUNITY_LIST_ERR_MALFORMED_VAL;
}
if (!com && !regex)
return COMMUNITY_LIST_ERR_MALFORMED_VAL;
entry = community_entry_new();
entry->direct = direct;

View File

@ -1467,13 +1467,12 @@ static mpls_label_t _vpn_leak_from_vrf_get_per_nexthop_label(
/* Unlink from any existing nexthop cache. Free the entry if unused.
*/
bgp_mplsvpn_path_nh_label_unlink(pi);
if (blnc) {
/* updates NHT pi list reference */
LIST_INSERT_HEAD(&(blnc->paths), pi, label_nh_thread);
pi->label_nexthop_cache = blnc;
pi->label_nexthop_cache->path_count++;
blnc->last_update = monotime(NULL);
}
/* updates NHT pi list reference */
LIST_INSERT_HEAD(&(blnc->paths), pi, label_nh_thread);
pi->label_nexthop_cache = blnc;
pi->label_nexthop_cache->path_count++;
blnc->last_update = monotime(NULL);
/* then add or update the selected nexthop */
if (!blnc->nh)

View File

@ -9199,6 +9199,8 @@ DEFPY(af_label_vpn_export_allocation_mode,
bool old_per_nexthop, new_per_nexthop;
afi = vpn_policy_getafi(vty, bgp, false);
if (afi == AFI_MAX)
return CMD_WARNING_CONFIG_FAILED;
old_per_nexthop = !!CHECK_FLAG(bgp->vpn_policy[afi].flags,
BGP_VPN_POLICY_TOVPN_LABEL_PER_NEXTHOP);
@ -20663,6 +20665,7 @@ DEFUN (community_list_standard,
argv_find(argv, argc, "AA:NN", &idx);
char *str = argv_concat(argv, argc, idx);
assert(str);
int ret = community_list_set(bgp_clist, cl_name_or_number, str, seq,
direct, style);
@ -20775,6 +20778,7 @@ DEFUN (community_list_expanded_all,
argv_find(argv, argc, "AA:NN", &idx);
char *str = argv_concat(argv, argc, idx);
assert(str);
int ret = community_list_set(bgp_clist, cl_name_or_number, str, seq,
direct, style);

View File

@ -842,9 +842,6 @@ static void eigrp_update_send_GR_part(struct eigrp_neighbor *nbr)
eigrp_fsm_event(&fsm_msg);
}
/* NULL the pointer */
dest_addr = NULL;
/* delete processed prefix from list */
listnode_delete(prefixes, pe);

View File

@ -338,8 +338,6 @@ static void zebra_mlag_post_data_from_main_thread(struct event *thread)
}
}
stream_free(s);
return;
stream_failure:
stream_free(s);
if (zebra_s)

View File

@ -507,8 +507,6 @@ static void zserv_process_messages(struct event *thread)
stream_fifo_push(cache, msg);
}
msg = NULL;
/* Need to reschedule processing work if there are still
* packets in the fifo.
*/