Merge pull request #2424 from pacovn/Coverity_1399270_Dereference_after_null_check

bgpd: null check (Coverity 1399270)
This commit is contained in:
Donald Sharp 2018-06-13 12:13:57 -04:00 committed by GitHub
commit 9c96d82fd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -102,6 +102,7 @@ struct community_list_handler *bgp_clist;
unsigned int multipath_num = MULTIPATH_NUM;
static void bgp_if_finish(struct bgp *bgp);
static void peer_drop_dynamic_neighbor(struct peer *peer);
extern struct zclient *zclient;
@ -3719,10 +3720,10 @@ struct peer *peer_lookup_dynamic_neighbor(struct bgp *bgp, union sockunion *su)
return peer;
}
void peer_drop_dynamic_neighbor(struct peer *peer)
static void peer_drop_dynamic_neighbor(struct peer *peer)
{
int dncount = -1;
if (peer->group && peer->group->bgp) {
if (peer->group->bgp) {
dncount = peer->group->bgp->dynamic_neighbors_count;
if (dncount)
peer->group->bgp->dynamic_neighbors_count = --dncount;
@ -3732,7 +3733,6 @@ void peer_drop_dynamic_neighbor(struct peer *peer)
peer->group->name, dncount);
}
/* If peer is configured at least one address family return 1. */
int peer_active(struct peer *peer)
{

View File

@ -1462,7 +1462,6 @@ extern struct peer_group *peer_group_lookup_dynamic_neighbor(struct bgp *,
struct prefix **);
extern struct peer *peer_lookup_dynamic_neighbor(struct bgp *,
union sockunion *);
extern void peer_drop_dynamic_neighbor(struct peer *);
/*
* Peers are incredibly easy to memory leak